⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 st-splash.c

📁 linux下网络收音机的源码
💻 C
字号:
/* * Copyright (c) 2004 Jean-Yves Lefort * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in the *    documentation and/or other materials provided with the distribution. * 3. Neither the name of Jean-Yves Lefort nor the names of its contributors *    may be used to endorse or promote products derived from this software *    without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */#include "config.h"#include <glib/gi18n.h>#include <gtk/gtk.h>#include "sgtk-hig.h"#include "st-splash.h"#include "st-util.h"/*** type definitions ********************************************************/struct _STSplashPrivate{  GtkWidget	*label;  GtkWidget	*progress_bar;};/*** function declarations ***************************************************/static void st_splash_class_init (STSplashClass *class);static void st_splash_init (STSplash *splash);/*** implementation **********************************************************/GTypest_splash_get_type (void){  static GType splash_type = 0;    if (! splash_type)    {      static const GTypeInfo splash_info = {	sizeof(STSplashClass),	NULL,	NULL,	(GClassInitFunc) st_splash_class_init,	NULL,	NULL,	sizeof(STSplash),	0,	(GInstanceInitFunc) st_splash_init,      };            splash_type = g_type_register_static(GTK_TYPE_WINDOW,					  "STSplash",					   &splash_info,					   0);    }    return splash_type;}static voidst_splash_class_init (STSplashClass *class){  g_type_class_add_private(class, sizeof(STSplashPrivate));}static voidst_splash_init (STSplash *splash){  GtkWidget *logo;  GtkWidget *vbox;  GtkWidget *frame;  splash->priv = G_TYPE_INSTANCE_GET_PRIVATE(splash, ST_TYPE_SPLASH, STSplashPrivate);    st_window_set_icon(GTK_WINDOW(splash));  gtk_window_set_title(GTK_WINDOW(splash), NULL);  gtk_window_set_resizable(GTK_WINDOW(splash), FALSE);  gtk_window_set_decorated(GTK_WINDOW(splash), FALSE);  gtk_window_set_type_hint(GTK_WINDOW(splash), GDK_WINDOW_TYPE_HINT_SPLASHSCREEN);  gtk_window_set_position(GTK_WINDOW(splash), GTK_WIN_POS_CENTER);  logo = st_logo_new();  splash->priv->label = gtk_label_new(_("Initializing..."));  splash->priv->progress_bar = gtk_progress_bar_new();    vbox = gtk_vbox_new(FALSE, SGTK_HIG_UNIT);  gtk_container_set_border_width(GTK_CONTAINER(vbox), SGTK_HIG_UNIT);  gtk_box_pack_start(GTK_BOX(vbox), logo, FALSE, FALSE, 0);  gtk_box_pack_start(GTK_BOX(vbox), splash->priv->label, FALSE, FALSE, 0);  gtk_box_pack_start(GTK_BOX(vbox), splash->priv->progress_bar, FALSE, FALSE, 0);  frame = gtk_frame_new(NULL);  gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT);  gtk_container_add(GTK_CONTAINER(frame), vbox);  gtk_container_add(GTK_CONTAINER(splash), frame);  gtk_widget_show_all(frame);}GtkWidget *st_splash_new (void){  return g_object_new(ST_TYPE_SPLASH, NULL);}voidst_splash_set_text (STSplash *splash, const char *str){  g_return_if_fail(ST_IS_SPLASH(splash));  g_return_if_fail(str != NULL);  gtk_label_set_text(GTK_LABEL(splash->priv->label), str);}voidst_splash_set_progress (STSplash *splash, double progress){  g_return_if_fail(ST_IS_SPLASH(splash));  gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(splash->priv->progress_bar), progress);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -