From 0c420dab45cb1422fd6d71be93737ef8622c32db Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Fri, 5 Oct 2007 11:55:17 +0300 Subject: [PATCH] Cleanups --- src/poi-gui.c | 42 +++++++++++------------------------------- 1 file changed, 11 insertions(+), 31 deletions(-) diff --git a/src/poi-gui.c b/src/poi-gui.c index ed706c5..4555093 100644 --- a/src/poi-gui.c +++ b/src/poi-gui.c @@ -36,7 +36,6 @@ category_delete(GtkWidget *widget, delete_poi *dpoi) GtkWidget *dialog; guint i; gchar *buffer; - printf("%s()\n", __PRETTY_FUNCTION__); buffer = g_strdup_printf("%s\n\t%s\n%s", _("Delete category?"), dpoi->txt_label, _("WARNING: All POIs in that category will also be deleted!")); @@ -52,7 +51,6 @@ category_delete(GtkWidget *widget, delete_poi *dpoi) map_force_redraw(); } - vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__); return TRUE; } @@ -73,7 +71,6 @@ category_dialog(guint cat_id) delete_poi dpoi = { NULL, NULL, 0 }; poi_category *c; - printf("%s()\n", __PRETTY_FUNCTION__); if (cat_id > 0) { if (poi_category_get(cat_id, &c)==FALSE) @@ -185,7 +182,6 @@ category_dialog(guint cat_id) g_object_unref(desc_txt); gtk_widget_hide_all(dialog); - vprintf("%s(): return\n", __PRETTY_FUNCTION__); return results; } @@ -195,7 +191,6 @@ category_toggled(GtkCellRendererToggle * cell, gchar * path, gpointer data) GtkTreeIter iter; gboolean cat_enabled; guint cat_id; - printf("%s()\n", __PRETTY_FUNCTION__); GtkTreeModel *model = GTK_TREE_MODEL(data); if (!gtk_tree_model_get_iter_from_string(model, &iter, path)) @@ -212,14 +207,12 @@ category_toggled(GtkCellRendererToggle * cell, gchar * path, gpointer data) gtk_list_store_set(GTK_LIST_STORE(model), &iter, CAT_ENABLED, cat_enabled, -1); } - vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__); } static gboolean category_add(GtkWidget * widget, GtkWidget * tree_view) { GtkListStore *store; - printf("%s()\n", __PRETTY_FUNCTION__); if (category_dialog(0)) { store = poi_category_generate_store(); @@ -227,7 +220,6 @@ category_add(GtkWidget * widget, GtkWidget * tree_view) GTK_TREE_MODEL(store)); g_object_unref(G_OBJECT(store)); } - vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__); return TRUE; } @@ -237,7 +229,6 @@ category_edit(GtkWidget * widget, GtkWidget * tree_view) GtkTreeIter iter; GtkTreeModel *store; GtkTreeSelection *selection; - printf("%s()\n", __PRETTY_FUNCTION__); store = gtk_tree_view_get_model(GTK_TREE_VIEW(tree_view)); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view)); @@ -252,7 +243,6 @@ category_edit(GtkWidget * widget, GtkWidget * tree_view) g_object_unref(G_OBJECT(new_store)); } } - vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__); return TRUE; } @@ -267,7 +257,6 @@ category_list() GtkTreeViewColumn *column; GtkCellRenderer *renderer; GtkListStore *store; - printf("%s()\n", __PRETTY_FUNCTION__); dialog = gtk_dialog_new_with_buttons(_("POI Categories"), GTK_WINDOW(_window), @@ -348,19 +337,16 @@ category_list() } gtk_widget_destroy(dialog); - vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__); return TRUE; } gboolean menu_cb_category(GtkAction * action) { - printf("%s()\n", __PRETTY_FUNCTION__); if (category_list()) map_force_redraw(); - vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__); return TRUE; } @@ -370,7 +356,6 @@ poi_delete_confirm(GtkWidget * widget, delete_poi * dpoi) GtkWidget *dialog; guint i; gchar *buffer; - printf("%s()\n", __PRETTY_FUNCTION__); buffer = g_strdup_printf("%s\n%s", _("Delete POI?"), dpoi->txt_label); dialog = hildon_note_new_confirmation(GTK_WINDOW(_window), buffer); @@ -387,7 +372,6 @@ poi_delete_confirm(GtkWidget * widget, delete_poi * dpoi) } } - vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__); return TRUE; } @@ -403,7 +387,6 @@ select_poi(guint unitx, guint unity, poi_info *poi) GtkTreeIter iter; gboolean selected = FALSE; guint num_cats; - printf("%s()\n", __PRETTY_FUNCTION__); if (poi_get_list(unitx, unity, &store, &num_cats)==FALSE) return FALSE; @@ -494,7 +477,6 @@ select_poi(guint unitx, guint unity, poi_info *poi) gtk_widget_destroy(dialog); - vprintf("%s(): return %d\n", __PRETTY_FUNCTION__, selected); return selected; } @@ -504,7 +486,6 @@ poi_populate_cat_combo(GtkWidget * cmb_category, guint cat_id) GtkTreeIter active; GtkListStore *store; gboolean has_active = FALSE; - printf("%s()\n", __PRETTY_FUNCTION__); store = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(cmb_category))); gtk_list_store_clear(store); @@ -525,8 +506,6 @@ poi_populate_cat_combo(GtkWidget * cmb_category, guint cat_id) gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &active); gtk_combo_box_set_active_iter(GTK_COMBO_BOX(cmb_category), &active); - - vprintf("%s(): return\n", __PRETTY_FUNCTION__); } typedef struct _PoiCategoryEditInfo PoiCategoryEditInfo; @@ -538,10 +517,8 @@ struct _PoiCategoryEditInfo { gboolean poi_edit_cat(GtkWidget * widget, PoiCategoryEditInfo * data) { -printf("%s()\n", __PRETTY_FUNCTION__); if (category_list()) poi_populate_cat_combo(data->cmb_category, data->cat_id); -vprintf("%s(): return\n", __PRETTY_FUNCTION__); return TRUE; } @@ -565,7 +542,6 @@ poi_dialog(POIAction action, guint unitx, guint unity) GtkTextIter begin, end; delete_poi dpoi = { NULL, NULL, 0 }; PoiCategoryEditInfo pcedit; - printf("%s()\n", __PRETTY_FUNCTION__); if (action == ACTION_EDIT_POI) { if (!select_poi(unitx, unity, &poi)) { @@ -753,7 +729,6 @@ poi_dialog(POIAction action, guint unitx, guint unity) gtk_widget_hide_all(dialog); - vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__); return TRUE; } @@ -788,15 +763,19 @@ dialog_qp = gtk_dialog_new_with_buttons(_("Quick POI"), gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_qp)->vbox), table = gtk_table_new(3, 3, FALSE), TRUE, TRUE, 0); -for (x=0;x<3;x++) { - for (y=0;y<3;y++) { +gtk_table_set_col_spacings(table, 6); +gtk_table_set_row_spacings(table, 6); +gtk_table_set_homogeneous(table, TRUE); + +for (x=1;x<=3;x++) { + for (y=1;y<=3;y++) { gchar *btnlabel; - btnlabel=g_strdup_printf("(%d)", (x+y)); - buttons[x+y]=gtk_button_new_with_label(btnlabel); - gtk_table_attach(GTK_TABLE(table), buttons[x+y], x, x+1, y, y+1, GTK_FILL, 0, 2, 4); + btnlabel=g_strdup_printf("(%d) %s", (x*y), "Poi name goes here..."); + buttons[x*y]=gtk_button_new_with_label(btnlabel); + gtk_table_attach(GTK_TABLE(table), buttons[x*y], x-1, x, y-1, y, GTK_FILL, 0, 2, 4); g_free(btnlabel); - g_signal_connect(G_OBJECT(buttons[x+y]), "clicked", G_CALLBACK(poi_quick_button_cb), NULL); + g_signal_connect(G_OBJECT(buttons[x*y]), "clicked", G_CALLBACK(poi_quick_button_cb), NULL); } } @@ -804,6 +783,7 @@ gtk_widget_show_all(dialog_qp); if (GTK_RESPONSE_REJECT == gtk_dialog_run(GTK_DIALOG(dialog_qp))) { gtk_widget_destroy(dialog_qp); + return TRUE; } return TRUE; -- 2.39.5