[Freeciv-Dev] (PR#12752) [PATCH] GTK+ 2.0 client UI fixes
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: |
[Freeciv-Dev] (PR#12752) [PATCH] GTK+ 2.0 client UI fixes |
From: |
"Vasco Alexandre da Silva Costa" <vasc@xxxxxxxxxxxxxx> |
Date: |
Sat, 9 Apr 2005 20:29:54 -0700 |
Reply-to: |
bugs@xxxxxxxxxxx |
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12752 >
This patch adds several UI fixes to the GTK+ 2.0 client. It moves the
city and player report menus to the bottom, moves message options to the
main tab area, plus some minor fixes.
Index: client/gui-gtk-2.0/cityrep.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/cityrep.c,v
retrieving revision 1.70
diff -u -u -r1.70 cityrep.c
--- client/gui-gtk-2.0/cityrep.c 4 Apr 2005 00:37:00 -0000 1.70
+++ client/gui-gtk-2.0/cityrep.c 10 Apr 2005 03:27:44 -0000
@@ -93,8 +93,7 @@
static void popup_next_menu(GtkMenuShell *menu, gpointer data);
static GtkWidget *city_center_command, *city_popup_command, *city_buy_command;
-static GtkWidget *city_change_command;
-static GtkWidget *city_last_command, *city_first_command, *city_next_command;
+static GtkWidget *city_production_command;
static GtkWidget *change_improvements_item;
@@ -667,28 +666,36 @@
*****************************************************************/
static GtkWidget *create_city_report_menubar(void)
{
- GtkWidget *menubar, *item;
+ GtkWidget *vbox, *sep, *menubar, *menu, *item;
+
+ vbox = gtk_vbox_new(FALSE, 0);
+ sep = gtk_hseparator_new();
+ gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0);
menubar = gtk_menu_bar_new();
+ gtk_box_pack_start(GTK_BOX(vbox), menubar, TRUE, TRUE, 0);
- item = gtk_menu_item_new_with_mnemonic(_("Chan_ge"));
+ item = gtk_menu_item_new_with_mnemonic(_("Pro_duction"));
+ city_production_command = item;
gtk_menu_shell_append(GTK_MENU_SHELL(menubar), item);
- city_change_command = item;
+
+ menu = gtk_menu_new();
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), menu);
+
+ item = gtk_menu_item_new_with_mnemonic(_("Chan_ge"));
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
create_change_menu(item);
item = gtk_menu_item_new_with_mnemonic(_("Add _First"));
- gtk_menu_shell_append(GTK_MENU_SHELL(menubar), item);
- city_first_command = item;
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
create_first_menu(item);
item = gtk_menu_item_new_with_mnemonic(_("Add _Next"));
- gtk_menu_shell_append(GTK_MENU_SHELL(menubar), item);
- city_next_command = item;
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
create_next_menu(item);
item = gtk_menu_item_new_with_mnemonic(_("Add _Last"));
- gtk_menu_shell_append(GTK_MENU_SHELL(menubar), item);
- city_last_command = item;
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
create_last_menu(item);
item = gtk_menu_item_new_with_mnemonic(_("_Select"));
@@ -698,7 +705,7 @@
item = gtk_menu_item_new_with_mnemonic(_("S_how"));
gtk_menu_shell_append(GTK_MENU_SHELL(menubar), item);
update_view_menu(item);
- return menubar;
+ return vbox;
}
/****************************************************************
@@ -785,8 +792,7 @@
/* menubar */
menubar = create_city_report_menubar();
- gtk_box_pack_start(GTK_BOX(city_dialog_shell->vbox),
- menubar, FALSE, FALSE, 0);
+ gui_dialog_add_widget(city_dialog_shell, menubar);
/* buttons */
w = gui_dialog_add_stockbutton(city_dialog_shell, GTK_STOCK_ZOOM_FIT,
@@ -1557,18 +1563,13 @@
n = gtk_tree_selection_count_selected_rows(selection);
if (n == 0) {
- gtk_widget_set_sensitive(city_change_command, FALSE);
- gtk_widget_set_sensitive(city_last_command, FALSE);
- gtk_widget_set_sensitive(city_first_command, FALSE);
- gtk_widget_set_sensitive(city_next_command, FALSE);
+ gtk_widget_set_sensitive(city_production_command, FALSE);
gtk_widget_set_sensitive(city_center_command, FALSE);
gtk_widget_set_sensitive(city_popup_command, FALSE);
gtk_widget_set_sensitive(city_buy_command, FALSE);
} else {
- gtk_widget_set_sensitive(city_change_command, can_client_issue_orders());
- gtk_widget_set_sensitive(city_last_command, can_client_issue_orders());
- gtk_widget_set_sensitive(city_first_command, can_client_issue_orders());
- gtk_widget_set_sensitive(city_next_command, can_client_issue_orders());
+ gtk_widget_set_sensitive(city_production_command,
+ can_client_issue_orders());
gtk_widget_set_sensitive(city_center_command, TRUE);
gtk_widget_set_sensitive(city_popup_command, TRUE);
gtk_widget_set_sensitive(city_buy_command, can_client_issue_orders());
Index: client/gui-gtk-2.0/gui_stuff.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/gui_stuff.c,v
retrieving revision 1.20
diff -u -u -r1.20 gui_stuff.c
--- client/gui-gtk-2.0/gui_stuff.c 5 Dec 2004 18:02:19 -0000 1.20
+++ client/gui-gtk-2.0/gui_stuff.c 10 Apr 2005 03:27:45 -0000
@@ -36,6 +36,8 @@
static GList *dialog_list;
+static GtkSizeGroup *gui_action;
+
/**************************************************************************
...
@@ -298,6 +300,8 @@
g_signal_handler_disconnect(notebook, handler_id);
}
+ g_object_unref(dlg->gui_button);
+
if (*(dlg->source)) {
*(dlg->source) = NULL;
}
@@ -383,16 +387,17 @@
dlg->type = GUI_DIALOG_WINDOW;
}
+ if (!gui_action) {
+ gui_action = gtk_size_group_new(GTK_SIZE_GROUP_VERTICAL);
+ }
+ dlg->gui_button = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
+
if (enable_tabs && notebook == GTK_NOTEBOOK(bottom_notebook)) {
vbox = gtk_hbox_new(FALSE, 0);
- action_area = gtk_vbutton_box_new();
- gtk_button_box_set_layout(GTK_BUTTON_BOX(action_area),
- GTK_BUTTONBOX_SPREAD);
+ action_area = gtk_vbox_new(FALSE, 2);
} else {
vbox = gtk_vbox_new(FALSE, 0);
- action_area = gtk_hbutton_box_new();
- gtk_button_box_set_layout(GTK_BUTTON_BOX(action_area),
- GTK_BUTTONBOX_END);
+ action_area = gtk_hbox_new(FALSE, 2);
}
gtk_widget_show(vbox);
@@ -509,6 +514,8 @@
}
gtk_box_pack_end(GTK_BOX(dlg->action_area), button, FALSE, TRUE, 0);
+ gtk_size_group_add_widget(gui_action, button);
+ gtk_size_group_add_widget(dlg->gui_button, button);
}
/**************************************************************************
@@ -543,6 +550,18 @@
}
/**************************************************************************
+ Adds a widget to a dialog.
+**************************************************************************/
+GtkWidget *gui_dialog_add_widget(struct gui_dialog *dlg,
+ GtkWidget *widget)
+{
+ gtk_box_pack_start(GTK_BOX(dlg->action_area), widget, FALSE, TRUE, 0);
+ gtk_size_group_add_widget(gui_action, widget);
+
+ return widget;
+}
+
+/**************************************************************************
Changes the default dialog response.
**************************************************************************/
void gui_dialog_set_default_response(struct gui_dialog *dlg, int response)
@@ -554,11 +573,14 @@
for (list = children; list; list = g_list_next(list)) {
GtkWidget *button = list->data;
- gpointer data = g_object_get_data(G_OBJECT(button),
- "gui-dialog-response-data");
- if (response == GPOINTER_TO_INT(data)) {
- gtk_widget_grab_default(button);
+ if (GTK_IS_BUTTON(button)) {
+ gpointer data = g_object_get_data(G_OBJECT(button),
+ "gui-dialog-response-data");
+
+ if (response == GPOINTER_TO_INT(data)) {
+ gtk_widget_grab_default(button);
+ }
}
}
@@ -578,11 +600,14 @@
for (list = children; list; list = g_list_next(list)) {
GtkWidget *button = list->data;
- gpointer data = g_object_get_data(G_OBJECT(button),
- "gui-dialog-response-data");
- if (response == GPOINTER_TO_INT(data)) {
- gtk_widget_set_sensitive(button, setting);
+ if (GTK_IS_BUTTON(button)) {
+ gpointer data = g_object_get_data(G_OBJECT(button),
+ "gui-dialog-response-data");
+
+ if (response == GPOINTER_TO_INT(data)) {
+ gtk_widget_set_sensitive(button, setting);
+ }
}
}
@@ -613,14 +638,20 @@
for (list = children; list; list = g_list_next(list)) {
GtkWidget *button = list->data;
- gpointer data = g_object_get_data(G_OBJECT(button),
- "gui-dialog-response-data");
- int response = GPOINTER_TO_INT(data);
- if (response != GTK_RESPONSE_CLOSE && response != GTK_RESPONSE_CANCEL) {
+ if (!GTK_IS_BUTTON(button)) {
num_visible++;
} else {
- gtk_widget_hide(button);
+ gpointer data = g_object_get_data(G_OBJECT(button),
+ "gui-dialog-response-data");
+ int response = GPOINTER_TO_INT(data);
+
+ if (response != GTK_RESPONSE_CLOSE
+ && response != GTK_RESPONSE_CANCEL) {
+ num_visible++;
+ } else {
+ gtk_widget_hide(button);
+ }
}
}
g_list_free(children);
Index: client/gui-gtk-2.0/gui_stuff.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/gui_stuff.h,v
retrieving revision 1.12
diff -u -u -r1.12 gui_stuff.h
--- client/gui-gtk-2.0/gui_stuff.h 23 Nov 2004 22:01:00 -0000 1.12
+++ client/gui-gtk-2.0/gui_stuff.h 10 Apr 2005 03:27:45 -0000
@@ -82,6 +82,8 @@
struct gui_dialog **source;
GUI_DIALOG_RESPONSE_FUN response_callback;
+
+ GtkSizeGroup *gui_button;
};
void gui_dialog_new(struct gui_dialog **pdlg, GtkNotebook *notebook);
@@ -90,6 +92,8 @@
const char *text, int response);
GtkWidget *gui_dialog_add_stockbutton(struct gui_dialog *dlg,
const char *stock, const char *text, int response);
+GtkWidget *gui_dialog_add_widget(struct gui_dialog *dlg,
+ GtkWidget *widget);
void gui_dialog_set_default_size(struct gui_dialog *dlg,
int width, int height);
void gui_dialog_set_title(struct gui_dialog *dlg, const char *title);
Index: client/gui-gtk-2.0/messagedlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/messagedlg.c,v
retrieving revision 1.19
diff -u -u -r1.19 messagedlg.c
--- client/gui-gtk-2.0/messagedlg.c 31 Oct 2004 20:45:54 -0000 1.19
+++ client/gui-gtk-2.0/messagedlg.c 10 Apr 2005 03:27:45 -0000
@@ -57,7 +57,7 @@
GtkWidget *form, *explanation;
int n, i, j;
- gui_dialog_new(&shell, GTK_NOTEBOOK(bottom_notebook));
+ gui_dialog_new(&shell, GTK_NOTEBOOK(top_notebook));
gui_dialog_set_title(shell, _("Message Options"));
gui_dialog_set_default_size(shell, -1, 450);
@@ -68,15 +68,15 @@
explanation = gtk_label_new(NULL);
gtk_label_set_markup(GTK_LABEL(explanation),
_("Where to display messages?\n"
- "\t<b>Out</b>put window ;\n"
- "\t<b>Mes</b>sages window ;\n"
- "\t<b>Pop</b>up individual window"));
+ "<b>Out</b>put window ; "
+ "<b>Mes</b>sages window ; "
+ "<b>Pop</b>up individual window"));
gtk_widget_set_name(explanation, "comment label");
- gtk_box_pack_start(GTK_BOX(shell->vbox), explanation, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(shell->vbox), explanation, FALSE, FALSE, 4);
gtk_widget_show(explanation);
- form = gtk_hbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(shell->vbox), form, TRUE, TRUE, 5);
+ form = gtk_vbox_new(FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(shell->vbox), form, TRUE, TRUE, 0);
for (n=0; n<NUM_LISTS; n++) {
model[n] = gtk_list_store_new(5,
@@ -108,13 +108,16 @@
GtkWidget *view, *sw;
GtkCellRenderer *renderer;
gint col;
+ GtkTreeViewColumn *column;
view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model[n]));
g_object_unref(model[n]);
renderer = gtk_cell_renderer_text_new();
- col = gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view),
- -1, _("Event"), renderer, "text", 3, NULL);
+ column = gtk_tree_view_column_new_with_attributes(_("Event"),
+ renderer, "text", 3, NULL);
+ gtk_tree_view_append_column(GTK_TREE_VIEW(view), column);
+ gtk_tree_view_column_set_expand(column, TRUE);
renderer = gtk_cell_renderer_toggle_new();
g_object_set_data(G_OBJECT(renderer), "column", GINT_TO_POINTER(0));
@@ -143,7 +146,7 @@
gtk_container_add(GTK_CONTAINER(sw), view);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
- GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
gtk_box_pack_start(GTK_BOX(form), sw, TRUE, TRUE, 0);
gtk_tree_view_focus(GTK_TREE_VIEW(view));
Index: client/gui-gtk-2.0/plrdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/plrdlg.c,v
retrieving revision 1.53
diff -u -u -r1.53 plrdlg.c
--- client/gui-gtk-2.0/plrdlg.c 28 Mar 2005 16:59:14 -0000 1.53
+++ client/gui-gtk-2.0/plrdlg.c 10 Apr 2005 03:27:45 -0000
@@ -283,7 +283,7 @@
{
int i;
GtkWidget *sep, *sw;
- GtkWidget *menubar, *menu, *item;
+ GtkWidget *menubar, *menu, *item, *vbox;
gui_dialog_new(&players_dialog_shell, GTK_NOTEBOOK(top_notebook));
gui_dialog_set_title(players_dialog_shell, _("Players"));
@@ -376,11 +376,19 @@
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
gtk_container_add(GTK_CONTAINER(sw), players_list);
- menubar = gtk_menu_bar_new();
- gtk_box_pack_start(GTK_BOX(players_dialog_shell->vbox), menubar,
- FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(players_dialog_shell->vbox), sw,
- TRUE, TRUE, 5);
+ TRUE, TRUE, 0);
+
+ vbox = gtk_vbox_new(FALSE, 0);
+ sep = gtk_hseparator_new();
+ gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0);
+
+ menubar = gtk_menu_bar_new();
+ gtk_box_pack_start(GTK_BOX(vbox), menubar, TRUE, TRUE, 0);
+
+ gui_dialog_add_widget(players_dialog_shell, vbox);
+ gtk_box_set_child_packing(GTK_BOX(players_dialog_shell->action_area),
+ vbox, FALSE, FALSE, 0, GTK_PACK_END);
item = gtk_menu_item_new_with_mnemonic(_("_Player"));
gtk_menu_shell_append(GTK_MENU_SHELL(menubar), item);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#12752) [PATCH] GTK+ 2.0 client UI fixes,
Vasco Alexandre da Silva Costa <=
|
|