Re: Hiding The Toolbar on Startup without flicker
- From: "Nickolay V. Shmyrev" <nshmyrev yandex ru>
- To: gnome-devel-list gnome org
- Subject: Re: Hiding The Toolbar on Startup without flicker
- Date: Sat, 03 Apr 2004 22:33:35 +0400
Maybe, you should not create toolbar on startup, if it is not needed?
Look at the attched patch.
Index: menu.c
===================================================================
RCS file: /cvs/gnome/gnome-games/aisleriot/menu.c,v
retrieving revision 1.71
diff -u -r1.71 menu.c
--- menu.c 25 Mar 2004 06:57:56 -0000 1.71
+++ menu.c 3 Apr 2004 18:29:49 -0000
@@ -34,6 +34,9 @@
static GtkWidget *about = NULL;
static gchar * gamename = NULL;
+static void toolbar_toggle_callback(GtkWidget * togglebutton, gpointer data);
+static void toolbar_show (void);
+static void toolbar_hide (void);
static void restart_game ()
{
@@ -142,41 +145,6 @@
gnome_help_display ("aisleriot.xml", gamename, NULL);
}
-static void toolbar_show (void)
-{
- GtkWidget * toolbar;
-
- toolbar = GTK_WIDGET(gnome_app_get_dock_item_by_name (GNOME_APP(app),
- GNOME_APP_TOOLBAR_NAME));
- gtk_widget_show (toolbar);
-}
-
-void toolbar_hide (void)
-{
- GtkWidget * toolbar;
-
- toolbar = GTK_WIDGET(gnome_app_get_dock_item_by_name (GNOME_APP(app),
- GNOME_APP_TOOLBAR_NAME));
- gtk_widget_hide (toolbar);
-}
-
-static void toolbar_toggle_callback(GtkWidget * togglebutton, gpointer data)
-{
- gboolean state;
-
- state = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (togglebutton));
-
- if (state) {
- toolbar_show();
- gconf_client_set_bool (gconf_client, "/apps/aisleriot/show_toolbar", TRUE,
- NULL);
- } else {
- toolbar_hide();
- gconf_client_set_bool (gconf_client, "/apps/aisleriot/show_toolbar", FALSE,
- NULL);
- }
-}
-
GnomeUIInfo rules_sub_menu[] = {
GNOMEUIINFO_END
};
@@ -309,7 +277,10 @@
void create_menus ()
{
gnome_app_create_menus (GNOME_APP(app), top_menu);
- gnome_app_create_toolbar (GNOME_APP(app), toolbar);
+ if (gconf_client_get_bool (gconf_client,
+ "/apps/aisleriot/show_toolbar", NULL)) {
+ gnome_app_create_toolbar (GNOME_APP(app), toolbar);
+ }
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (view_menu[0].widget),
gconf_client_get_bool (gconf_client,
@@ -322,3 +293,46 @@
gnome_app_install_menu_hints(GNOME_APP (app), top_menu);
}
+static void toolbar_show (void)
+{
+ GtkWidget * toolbar;
+
+ toolbar = GTK_WIDGET(gnome_app_get_dock_item_by_name (GNOME_APP(app),
+ GNOME_APP_TOOLBAR_NAME));
+
+ if (toolbar == NULL) {
+ gnome_app_create_toolbar (GNOME_APP(app), toolbar);
+ toolbar = GTK_WIDGET(gnome_app_get_dock_item_by_name (GNOME_APP(app),
+ GNOME_APP_TOOLBAR_NAME));
+ }
+ gtk_widget_show (toolbar);
+}
+
+void toolbar_hide (void)
+{
+ GtkWidget * toolbar;
+
+ toolbar = GTK_WIDGET(gnome_app_get_dock_item_by_name (GNOME_APP(app),
+ GNOME_APP_TOOLBAR_NAME));
+ if (toolbar == NULL)
+ return;
+
+ gtk_widget_hide (toolbar);
+}
+
+static void toolbar_toggle_callback(GtkWidget * togglebutton, gpointer data)
+{
+ gboolean state;
+
+ state = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (togglebutton));
+
+ if (state) {
+ toolbar_show();
+ gconf_client_set_bool (gconf_client, "/apps/aisleriot/show_toolbar", TRUE,
+ NULL);
+ } else {
+ toolbar_hide();
+ gconf_client_set_bool (gconf_client, "/apps/aisleriot/show_toolbar", FALSE,
+ NULL);
+ }
+}
\ No newline at end of file
Index: sol.c
===================================================================
RCS file: /cvs/gnome/gnome-games/aisleriot/sol.c,v
retrieving revision 1.98
diff -u -r1.98 sol.c
--- sol.c 19 Mar 2004 07:30:40 -0000 1.98
+++ sol.c 3 Apr 2004 18:29:49 -0000
@@ -377,10 +377,6 @@
gtk_widget_show_all (app);
- if (!gconf_client_get_bool (gconf_client,
- "/apps/aisleriot/show_toolbar", NULL))
- toolbar_hide();
-
create_press_data (playing_area->window);
gtk_main ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]