Re: [evolution-patches] Cleanups for evolution/widgets/misc



fre, 22,.09.2006 kl. 17.11 +0200, skrev Kjartan Maraas:
> tir, 29,.08.2006 kl. 22.37 +0200, skrev Kjartan Maraas:
> > Same as before and add a check for a null esb in set_option. This showed
> > up in some valgrind runs I did as "use of uninitialized variable".
> 
> Another rediff against current CVS.
> 
Unified this one too.

Cheers
Kjartan

? warnings
Index: e-filter-bar.c
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/e-filter-bar.c,v
retrieving revision 1.57
diff -u -p -r1.57 e-filter-bar.c
--- e-filter-bar.c	21 Aug 2006 05:57:39 -0000	1.57
+++ e-filter-bar.c	22 Sep 2006 15:27:03 -0000
@@ -106,8 +106,7 @@ static void
 rule_advanced_response (GtkWidget *dialog, int response, void *data)
 {
 	EFilterBar *efb = data;
-	/* the below generates a compiler warning about incompatible pointer types */
-	ESearchBar *esb = efb;
+	ESearchBar *esb = (ESearchBar *)efb;
 	FilterRule *rule;
 	
 	if (response == GTK_RESPONSE_OK || response == GTK_RESPONSE_APPLY) {
@@ -239,7 +238,7 @@ static void
 menubar_activated (ESearchBar *esb, int id, void *data)
 {
 	EFilterBar *efb = (EFilterBar *)esb;
-	GtkWidget *dialog, *w;
+	GtkWidget *dialog;
 	
 	d(printf ("menubar activated!\n"));
 
@@ -464,7 +463,7 @@ generate_menu (ESearchBar *esb, ESearchB
 static void
 free_items (ESearchBarItem *items)
 {
-	int i, j;
+	int i;
 	
 	for (i = 0; items[i].id != -1; i++) 
 		g_free (items[i].text);
@@ -861,7 +860,7 @@ e_filter_bar_new (RuleContext *context,
 		  void *data)
 {
 	EFilterBar *bar;
-	ESearchBarItem item = { NULL, -1, NULL };
+	ESearchBarItem item = { NULL, -1, 0 };
 	
 	bar = gtk_type_new (e_filter_bar_get_type ());
 
Index: e-icon-entry.c
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/e-icon-entry.c,v
retrieving revision 1.4
diff -u -p -r1.4 e-icon-entry.c
--- e-icon-entry.c	20 Aug 2006 14:47:41 -0000	1.4
+++ e-icon-entry.c	22 Sep 2006 15:27:03 -0000
@@ -334,7 +334,6 @@ e_icon_entry_pack_widget (EIconEntry *en
 			     gboolean start)
 {
 	EIconEntryPrivate *priv;
-	GtkWidget *box;
 
 	g_return_if_fail (E_IS_ICON_ENTRY (entry));
 
@@ -371,13 +370,13 @@ e_icon_entry_create_button (const char *
 
 	eventbox = gtk_event_box_new ();
 	gtk_container_set_border_width (GTK_CONTAINER (eventbox), 2);
-	gtk_event_box_set_visible_window ((eventbox), FALSE);
+	gtk_event_box_set_visible_window (GTK_EVENT_BOX (eventbox), FALSE);
 
 	image = gtk_image_new_from_stock (stock, GTK_ICON_SIZE_MENU);
 	gtk_container_add (GTK_CONTAINER (eventbox), image);
 
-	g_signal_connect_after (eventbox, "enter-notify-event", set_cursor, NULL);
-	g_signal_connect_after (eventbox, "leave-notify-event", set_cursor, NULL);
+	g_signal_connect_after (eventbox, "enter-notify-event", G_CALLBACK (set_cursor), NULL);
+	g_signal_connect_after (eventbox, "leave-notify-event", G_CALLBACK (set_cursor), NULL);
 
 	return eventbox;
 }
Index: e-search-bar.c
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/e-search-bar.c,v
retrieving revision 1.109
diff -u -p -r1.109 e-search-bar.c
--- e-search-bar.c	28 Aug 2006 06:53:55 -0000	1.109
+++ e-search-bar.c	22 Sep 2006 15:27:03 -0000
@@ -302,7 +302,7 @@ paint_search_text (GtkWidget *widget, ES
 	
 	if (!GTK_WIDGET_SENSITIVE (esb->option_button)) {
 		menu_widget = esb->scopeoption_menu;
-		text = g_object_get_data (gtk_menu_get_active ( GTK_MENU (esb->scopeoption_menu)),"string");
+		text = g_object_get_data (G_OBJECT (gtk_menu_get_active ( GTK_MENU (esb->scopeoption_menu))), "string");
 	} else if (!GTK_IS_RADIO_MENU_ITEM (gtk_menu_get_active ( GTK_MENU (esb->option_menu))))
 		return FALSE;
 	else /* no query in search entry .. so set the current option */
@@ -448,7 +448,7 @@ option_activated_cb (GtkWidget *widget,
 /* 	id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "EsbItemId")); */
 
 /* 	esb->item_id = id; */
-	char *text;
+	const gchar *text;
 
 	if (GTK_IS_RADIO_MENU_ITEM (gtk_menu_get_active ( GTK_MENU (esb->option_menu)))) {
 		text = get_selected_item_label (esb->option_menu);
@@ -500,7 +500,6 @@ static void
 scopeoption_changed_cb (GtkWidget *option_menu, ESearchBar *search_bar)
 {
 	const gchar *text = NULL;
-	GtkStyle *style = gtk_widget_get_default_style ();
 
 	text = e_search_bar_get_text (search_bar);
 	if (!(text && *text))
@@ -511,6 +510,7 @@ scopeoption_changed_cb (GtkWidget *optio
 
 /* Widgetry creation.  */
 
+#if 0
 /* This function exists to fix the irreparable GtkOptionMenu stupidity.  In
    fact, this lame-ass widget adds a 1-pixel-wide empty border around the
    button for no reason.  So we have add a 1-pixel-wide border around the the
@@ -527,6 +527,7 @@ put_in_spacer_widget (GtkWidget *widget)
 
 	return holder;
 }
+#endif
 
 static void
 append_xml_menu_item (GString *xml,
@@ -658,7 +659,7 @@ set_option (ESearchBar *esb, ESearchBarI
 	GSList *group = NULL;
 	int i;
 
-	if (esb->option_menu) 
+	if (esb && esb->option_menu) 
 		gtk_widget_destroy (esb->option_menu);
 
 	esb->option_menu = menu = gtk_menu_new ();
@@ -705,7 +706,7 @@ set_option (ESearchBar *esb, ESearchBarI
 	}
 
 	gtk_widget_show_all (menu);
-	g_object_set_data (esb->option_menu, "group", group);
+	g_object_set_data (G_OBJECT (esb->option_menu), "group", group);
  	entry_focus_out_cb (esb->entry, NULL, esb);
 }
 
@@ -951,11 +952,11 @@ e_search_bar_construct (ESearchBar *sear
 			  G_CALLBACK (entry_key_press_cb), search_bar);
 
 	search_bar->clear_button = e_icon_entry_create_button ("gtk-clear");
-	g_signal_connect (G_OBJECT (search_bar->clear_button), "button-press-event", clear_button_clicked_cb, search_bar);
+	g_signal_connect (G_OBJECT (search_bar->clear_button), "button-press-event", G_CALLBACK (clear_button_clicked_cb), search_bar);
 	e_icon_entry_pack_widget (E_ICON_ENTRY (search_bar->icon_entry), search_bar->clear_button, FALSE);
 
 	search_bar->option_button = e_icon_entry_create_button ("gtk-find");
-	g_signal_connect (G_OBJECT (search_bar->option_button), "button-press-event", option_button_clicked_cb, search_bar);
+	g_signal_connect (G_OBJECT (search_bar->option_button), "button-press-event", G_CALLBACK (option_button_clicked_cb), search_bar);
 	e_icon_entry_pack_widget (E_ICON_ENTRY (search_bar->icon_entry), search_bar->option_button, TRUE);
 
 	gtk_box_pack_start (GTK_BOX(search_bar->entry_box), search_bar->icon_entry, FALSE, FALSE, 0);
@@ -973,7 +974,7 @@ e_search_bar_construct (ESearchBar *sear
 	gtk_box_pack_start (GTK_BOX(search_bar->viewoption_box), label, FALSE, FALSE, 0);
 
 	search_bar->viewoption = gtk_option_menu_new ();
-	gtk_label_set_mnemonic_widget (label, search_bar->viewoption);
+	gtk_label_set_mnemonic_widget (GTK_LABEL (label), search_bar->viewoption);
 	gtk_box_pack_start (GTK_BOX(search_bar->viewoption_box), search_bar->viewoption, FALSE, TRUE, 0);
 	gtk_widget_show_all (search_bar->viewoption_box);
 	gtk_box_pack_start (GTK_BOX(search_bar), search_bar->viewoption_box, FALSE, FALSE, 0);
@@ -990,7 +991,7 @@ e_search_bar_construct (ESearchBar *sear
 	gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 0);
 	gtk_box_pack_start (GTK_BOX(hbox), search_bar->entry_box, FALSE, FALSE, 0);
 	gtk_widget_show (search_bar->entry_box);
-	gtk_label_set_mnemonic_widget (label, search_bar->entry);
+	gtk_label_set_mnemonic_widget (GTK_LABEL (label), search_bar->entry);
 
 	/* Search Scope Widgets */
 	search_bar->scopeoption_box = gtk_hbox_new (0, FALSE);
@@ -1002,11 +1003,11 @@ e_search_bar_construct (ESearchBar *sear
 	gtk_box_pack_start (GTK_BOX(search_bar->scopeoption_box), label, FALSE, FALSE, 0);
 
 	search_bar->scopeoption = gtk_option_menu_new ();
-	g_signal_connect (GTK_OPTION_MENU (search_bar->scopeoption), "changed", scopeoption_changed_cb, search_bar);
+	g_signal_connect (GTK_OPTION_MENU (search_bar->scopeoption), "changed", G_CALLBACK (scopeoption_changed_cb), search_bar);
 	gtk_box_pack_start (GTK_BOX(search_bar->scopeoption_box), search_bar->scopeoption, FALSE, FALSE, 0);
 	gtk_widget_show_all (search_bar->scopeoption_box);
 	gtk_widget_hide (hbox);
-	gtk_label_set_mnemonic_widget (label, search_bar->scopeoption);
+	gtk_label_set_mnemonic_widget (GTK_LABEL (label), search_bar->scopeoption);
 
 	gtk_box_pack_end (GTK_BOX(hbox), search_bar->scopeoption_box, FALSE, FALSE, 0);
 	gtk_widget_hide (search_bar->scopeoption_box);
@@ -1333,7 +1334,7 @@ e_search_bar_set_item_id (ESearchBar *se
 	if (id>=0)
 		search_bar->last_search_option = id;
 	search_bar->item_id = id;
-	gtk_menu_set_active (search_bar->option_menu, row);
+	gtk_menu_set_active (GTK_MENU (search_bar->option_menu), row);
 
 	emit_query_changed (search_bar);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]