Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2004:
[Freeciv-Dev] (PR#10629) [PATCH] Move city description from window title
Home

[Freeciv-Dev] (PR#10629) [PATCH] Move city description from window title

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#10629) [PATCH] Move city description from window title to inside the dialog.
From: "Vasco Alexandre da Silva Costa" <vasc@xxxxxxxxxxxxxx>
Date: Sat, 23 Oct 2004 13:59:57 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=10629 >

> [jdorje - Tue Oct 19 21:16:51 2004]:
> 
> Vasco Alexandre da Silva Costa wrote:
> > <URL: http://rt.freeciv.org/Ticket/Display.html?id=10629 >
> > 
> > Requested by Mike.
> 
> > -  pdialog->shell = gtk_dialog_new_with_buttons(pcity->name,
> > +  pdialog->shell = gtk_dialog_new_with_buttons(_("City"),
> 
> If there are multiple city dialogs, they should have better names than 
> this.  Why not just use the city name for the window title?

Here it is.

Index: client/gui-gtk-2.0/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/citydlg.c,v
retrieving revision 1.96
diff -u -r1.96 citydlg.c
--- client/gui-gtk-2.0/citydlg.c        19 Oct 2004 16:35:33 -0000      1.96
+++ client/gui-gtk-2.0/citydlg.c        23 Oct 2004 20:59:42 -0000
@@ -103,6 +103,7 @@
   struct city *pcity;
 
   GtkWidget *shell;
+  GtkWidget *name_label;
   GtkWidget *citizen_pixmap;
   GdkPixmap *map_canvas_store;
   GtkWidget *notebook;
@@ -1135,6 +1136,9 @@
 
   vbox = GTK_DIALOG(pdialog->shell)->vbox;
 
+  pdialog->name_label = gtk_label_new(NULL);
+  gtk_box_pack_start(GTK_BOX(vbox), pdialog->name_label, TRUE, TRUE, 2);
+
   /**** -Start of Notebook- ****/
 
   pdialog->notebook = gtk_notebook_new();
@@ -1237,9 +1241,9 @@
 static void city_dialog_update_title(struct city_dialog *pdialog)
 {
   char buf[512];
-  char *now;
+  const gchar *now;
 
-  my_snprintf(buf, sizeof(buf), _("%s - %s citizens"),
+  my_snprintf(buf, sizeof(buf), _("<b>%s</b> - %s citizens"),
              pdialog->pcity->name,
              population_to_text(city_population(pdialog->pcity)));
 
@@ -1251,9 +1255,10 @@
     mystrlcat(buf, _(" - happy"), sizeof(buf));
   }
 
-  now = GTK_WINDOW(pdialog->shell)->title;
+  now = gtk_label_get_text(GTK_LABEL(pdialog->name_label));
   if (strcmp(now, buf) != 0) {
-    gtk_window_set_title(GTK_WINDOW(pdialog->shell), buf);
+    gtk_window_set_title(GTK_WINDOW(pdialog->shell), pdialog->pcity->name);
+    gtk_label_set_markup(GTK_LABEL(pdialog->name_label), buf);
   }
 }
 

[Prev in Thread] Current Thread [Next in Thread]