Author: cazfi
Date: Tue Jun 28 18:58:02 2016
New Revision: 33084

URL: http://svn.gna.org/viewcvs/freeciv?rev=33084&view=rev
Log:
Make happiness widget narrower on gtk3-client in tinyscreen mode.

See bug #24265

Modified:
    trunk/client/gui-gtk-3.0/citydlg.c
    trunk/client/gui-gtk-3.0/happiness.c
    trunk/client/gui-gtk-3.0/happiness.h
    trunk/client/gui-gtk-3.x/citydlg.c
    trunk/client/gui-gtk-3.x/happiness.c
    trunk/client/gui-gtk-3.x/happiness.h

Modified: trunk/client/gui-gtk-3.0/citydlg.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/citydlg.c?rev=33084&r1=33083&r2=33084&view=diff
==============================================================================
--- trunk/client/gui-gtk-3.0/citydlg.c  (original)
+++ trunk/client/gui-gtk-3.0/citydlg.c  Tue Jun 28 18:58:02 2016
@@ -1302,7 +1302,7 @@
                                  GTK_ORIENTATION_VERTICAL);
   gtk_container_add(GTK_CONTAINER(right), pdialog->happiness.widget);
   gtk_container_add(GTK_CONTAINER(pdialog->happiness.widget),
-                    get_top_happiness_display(pdialog->pcity));
+                    get_top_happiness_display(pdialog->pcity, low_citydlg));
 
   /* show page */
   gtk_widget_show_all(page);
@@ -3386,7 +3386,7 @@
                       citizens_dialog_display(pdialog->pcity));
   }
   gtk_container_add(GTK_CONTAINER(pdialog->happiness.widget),
-                    get_top_happiness_display(pdialog->pcity));
+                    get_top_happiness_display(pdialog->pcity, low_citydlg));
   if (!client_is_observer()) {
     fc_assert(pdialog->cma_editor != NULL);
     pdialog->cma_editor->pcity = new_pcity;

Modified: trunk/client/gui-gtk-3.0/happiness.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/happiness.c?rev=33084&r1=33083&r2=33084&view=diff
==============================================================================
--- trunk/client/gui-gtk-3.0/happiness.c        (original)
+++ trunk/client/gui-gtk-3.0/happiness.c        Tue Jun 28 18:58:02 2016
@@ -1,4 +1,4 @@
-/**********************************************************************
+/***********************************************************************
  Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -69,7 +69,8 @@
 
 static struct dialog_list *dialog_list;
 static struct happiness_dialog *get_happiness_dialog(struct city *pcity);
-static struct happiness_dialog *create_happiness_dialog(struct city *pcity);
+static struct happiness_dialog *create_happiness_dialog(struct city *pcity,
+                                                        bool low_dlg);
 static gboolean show_happiness_popup(GtkWidget *w,
                                      GdkEventButton *ev,
                                      gpointer data);
@@ -189,11 +190,13 @@
 /**************************************************************************
   Create the happiness notebook page.
 **************************************************************************/
-static struct happiness_dialog *create_happiness_dialog(struct city *pcity)
+static struct happiness_dialog *create_happiness_dialog(struct city *pcity,
+                                                        bool low_dlg)
 {
   int i;
   struct happiness_dialog *pdialog;
   GtkWidget *ebox, *label, *table;
+  char buf[700];
 
   static const char *happiness_label_str[NUM_HAPPINESS_MODIFIERS] = {
     N_("Cities:"),
@@ -257,9 +260,12 @@
     gtk_grid_attach(GTK_GRID(table), ebox, 1, i, 1, 1);
   }
 
-  /* TRANS: the width of this text defines the width of the city dialog. */
-  label = gtk_label_new(_("Additional information is available via left "
-                          "click on the citizens."));
+  /* TRANS: the width of this text defines the width of the city dialog.
+   *        '%s' is either space or newline depending on screen real estate. */
+  fc_snprintf(buf, sizeof(buf),
+              _("Additional information is available%svia left "
+                "click on the citizens."), low_dlg ? "\n" : " ");
+  label = gtk_label_new(buf);
   gtk_widget_set_name(label, "city_label");
   gtk_widget_set_halign(label, GTK_ALIGN_START);
   gtk_widget_set_valign(label, GTK_ALIGN_CENTER);
@@ -339,7 +345,7 @@
 /**************************************************************************
   Create happiness dialog and get its widget
 **************************************************************************/
-GtkWidget *get_top_happiness_display(struct city *pcity)
-{
-  return create_happiness_dialog(pcity)->shell;
-}
+GtkWidget *get_top_happiness_display(struct city *pcity, bool low_dlg)
+{
+  return create_happiness_dialog(pcity, low_dlg)->shell;
+}

Modified: trunk/client/gui-gtk-3.0/happiness.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/happiness.h?rev=33084&r1=33083&r2=33084&view=diff
==============================================================================
--- trunk/client/gui-gtk-3.0/happiness.h        (original)
+++ trunk/client/gui-gtk-3.0/happiness.h        Tue Jun 28 18:58:02 2016
@@ -1,4 +1,4 @@
-/********************************************************************** 
+/***********************************************************************
  Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -20,8 +20,9 @@
 
 void happiness_dialog_init(void);
 void happiness_dialog_done(void);
-GtkWidget *get_top_happiness_display(struct city *pcity);
+GtkWidget *get_top_happiness_display(struct city *pcity,
+                                     bool low_dlg);
 void close_happiness_dialog(struct city *pcity);
 void refresh_happiness_dialog(struct city *pcity);
 
-#endif                         /* FC__HAPPINESS_H */
+#endif /* FC__HAPPINESS_H */

Modified: trunk/client/gui-gtk-3.x/citydlg.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.x/citydlg.c?rev=33084&r1=33083&r2=33084&view=diff
==============================================================================
--- trunk/client/gui-gtk-3.x/citydlg.c  (original)
+++ trunk/client/gui-gtk-3.x/citydlg.c  Tue Jun 28 18:58:02 2016
@@ -1302,7 +1302,7 @@
                                  GTK_ORIENTATION_VERTICAL);
   gtk_container_add(GTK_CONTAINER(right), pdialog->happiness.widget);
   gtk_container_add(GTK_CONTAINER(pdialog->happiness.widget),
-                    get_top_happiness_display(pdialog->pcity));
+                    get_top_happiness_display(pdialog->pcity, low_citydlg));
 
   /* show page */
   gtk_widget_show_all(page);
@@ -3420,7 +3420,7 @@
                       citizens_dialog_display(pdialog->pcity));
   }
   gtk_container_add(GTK_CONTAINER(pdialog->happiness.widget),
-                    get_top_happiness_display(pdialog->pcity));
+                    get_top_happiness_display(pdialog->pcity, low_citydlg));
   if (!client_is_observer()) {
     fc_assert(pdialog->cma_editor != NULL);
     pdialog->cma_editor->pcity = new_pcity;

Modified: trunk/client/gui-gtk-3.x/happiness.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.x/happiness.c?rev=33084&r1=33083&r2=33084&view=diff
==============================================================================
--- trunk/client/gui-gtk-3.x/happiness.c        (original)
+++ trunk/client/gui-gtk-3.x/happiness.c        Tue Jun 28 18:58:02 2016
@@ -1,4 +1,4 @@
-/**********************************************************************
+/***********************************************************************
  Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -69,7 +69,8 @@
 
 static struct dialog_list *dialog_list;
 static struct happiness_dialog *get_happiness_dialog(struct city *pcity);
-static struct happiness_dialog *create_happiness_dialog(struct city *pcity);
+static struct happiness_dialog *create_happiness_dialog(struct city *pcity,
+                                                        bool low_dlg);
 static gboolean show_happiness_popup(GtkWidget *w,
                                      GdkEventButton *ev,
                                      gpointer data);
@@ -189,11 +190,13 @@
 /**************************************************************************
   Create the happiness notebook page.
 **************************************************************************/
-static struct happiness_dialog *create_happiness_dialog(struct city *pcity)
+static struct happiness_dialog *create_happiness_dialog(struct city *pcity,
+                                                        bool low_dlg)
 {
   int i;
   struct happiness_dialog *pdialog;
   GtkWidget *ebox, *label, *table;
+  char buf[700];
 
   static const char *happiness_label_str[NUM_HAPPINESS_MODIFIERS] = {
     N_("Cities:"),
@@ -257,9 +260,12 @@
     gtk_grid_attach(GTK_GRID(table), ebox, 1, i, 1, 1);
   }
 
-  /* TRANS: the width of this text defines the width of the city dialog. */
-  label = gtk_label_new(_("Additional information is available via left "
-                          "click on the citizens."));
+  /* TRANS: the width of this text defines the width of the city dialog.
+   *        '%s' is either space or newline depending on screen real estate. */
+  fc_snprintf(buf, sizeof(buf),
+              _("Additional information is available%svia left "
+                "click on the citizens."), low_dlg ? "\n" : " ");
+  label = gtk_label_new(buf);
   gtk_widget_set_name(label, "city_label");
   gtk_widget_set_halign(label, GTK_ALIGN_START);
   gtk_widget_set_valign(label, GTK_ALIGN_CENTER);
@@ -339,7 +345,7 @@
 /**************************************************************************
   Create happiness dialog and get its widget
 **************************************************************************/
-GtkWidget *get_top_happiness_display(struct city *pcity)
-{
-  return create_happiness_dialog(pcity)->shell;
-}
+GtkWidget *get_top_happiness_display(struct city *pcity, bool low_dlg)
+{
+  return create_happiness_dialog(pcity, low_dlg)->shell;
+}

Modified: trunk/client/gui-gtk-3.x/happiness.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.x/happiness.h?rev=33084&r1=33083&r2=33084&view=diff
==============================================================================
--- trunk/client/gui-gtk-3.x/happiness.h        (original)
+++ trunk/client/gui-gtk-3.x/happiness.h        Tue Jun 28 18:58:02 2016
@@ -1,4 +1,4 @@
-/********************************************************************** 
+/***********************************************************************
  Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -20,8 +20,9 @@
 
 void happiness_dialog_init(void);
 void happiness_dialog_done(void);
-GtkWidget *get_top_happiness_display(struct city *pcity);
+GtkWidget *get_top_happiness_display(struct city *pcity,
+                                     bool low_dlg);
 void close_happiness_dialog(struct city *pcity);
 void refresh_happiness_dialog(struct city *pcity);
 
-#endif                         /* FC__HAPPINESS_H */
+#endif /* FC__HAPPINESS_H */


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to