Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2003:
[Freeciv-Dev] (PR#3356) tooltips for the indicator icons (gtk2)
Home

[Freeciv-Dev] (PR#3356) tooltips for the indicator icons (gtk2)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] (PR#3356) tooltips for the indicator icons (gtk2)
From: "Jason Short via RT" <rt@xxxxxxxxxxxxxx>
Date: Sat, 8 Feb 2003 23:47:23 -0800
Reply-to: rt.freeciv.org@xxxxxxxxxxxxxx

The attached patch provides tooltips for the indicator icons on the left.

Adding one extra layer of GtkEventBox'es was needed (for the
bulb/sun/flake/government icons) since a GtkImage can't hold a tooltip.

Rather than adding an extra GtkEventBox for the tax icons, I just added
the tooltip separately to each already-existing event box.  This means
each tax icon has its own tooltip (although they are all the same). 
This could be fixed, but it means changing more code...

The texts for the icons are rather poor.  In particular, I had no idea
what most of them did before I sat down to write descriptive texts for
them.  Anything better would be welcome.

jason

Index: client/gui-gtk-2.0/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/gui_main.c,v
retrieving revision 1.40
diff -u -r1.40 gui_main.c
--- client/gui-gtk-2.0/gui_main.c       2003/02/05 07:23:47     1.40
+++ client/gui-gtk-2.0/gui_main.c       2003/02/09 07:42:49
@@ -593,6 +593,7 @@
   GtkWidget *avbox, *ahbox;
   GtkWidget *frame, *table, *paned, *menubar, *sw, *text;
   GtkStyle *style;
+  GtkTooltips *tooltips = gtk_tooltips_new();
   int i;
   struct Sprite *sprite;
 
@@ -686,6 +687,10 @@
     sprite = get_citizen_sprite(c, i, NULL);
     econ_label[i] = gtk_image_new_from_pixmap(sprite->pixmap, sprite->mask);
     gtk_container_add(GTK_CONTAINER(ebox), econ_label[i]);
+
+    gtk_tooltips_set_tip(tooltips, ebox,
+                        _("Shows your current tax/luxury/science rates; "
+                          "click to toggle them."), NULL);
   }
 
   /* science, environmental, govt, timeout */
@@ -697,19 +702,38 @@
 
   for (i = 0; i < 4; i++) {
     GtkWidget *w;
+    const char *text;
+
+    ebox = gtk_event_box_new();
+    gtk_table_attach_defaults(GTK_TABLE(table), ebox, i, i + 1, 1, 2);
     
     switch (i) {
-      case 0: w = bulb_label;        break;
-      case 1: w = sun_label;         break;
-      case 2: w = flake_label;        break;
+      case 0:
+       w = bulb_label;
+       text = _("Shows your progress in researching the current "
+                "technology.");
+       break;
+      case 1:
+       w = sun_label;
+       text = _("Shows the progress of global warming.");
+       break;
+      case 2:
+       w = flake_label;
+       text = _("Shows the progress of global cooling (nuclear winter).");
+        break;
       default:
-      case 3: w = government_label;   break;
+      case 3:
+       w = government_label;
+       text = _("Shows your current government.");
+       break;
     }
 
+    gtk_tooltips_set_tip(tooltips, ebox, text, NULL);
+
     gtk_misc_set_alignment(GTK_MISC(w), 0.0, 0.0);
     gtk_misc_set_padding(GTK_MISC(w), 0, 0);
     gtk_widget_set_size_request(w, SMALL_TILE_WIDTH, SMALL_TILE_HEIGHT);
-    gtk_table_attach_defaults(GTK_TABLE(table), w, i, i + 1, 1, 2);
+    gtk_container_add(GTK_CONTAINER(ebox), w);
   }
 
   timeout_label = gtk_label_new("");

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#3356) tooltips for the indicator icons (gtk2), Jason Short via RT <=