[easytag/wip/unstable: 15/56] Use a toolbar for the picture tab buttons
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/unstable: 15/56] Use a toolbar for the picture tab buttons
- Date: Sat, 4 Jan 2014 15:05:41 +0000 (UTC)
commit 7161aa9fecd1588471ce9485ab5d23fe5082f95f
Author: David King <amigadave amigadave com>
Date: Sun Apr 7 10:29:40 2013 +0100
Use a toolbar for the picture tab buttons
Use a toolbar for the control buttons underneath the picture tab tree
view. Update the sensitivity of the toolbar buttons depending on the
selected items (make the remove, save and property buttons insensitive
if no items are selected). Improve the string for removing images.
Remove some commented-out code for setting the tag area widgets to be
insensitive.
src/easytag.c | 234 ++++++++++++++++++++++++++++-----------------------------
src/easytag.h | 12 ++--
src/picture.c | 36 +++++----
3 files changed, 140 insertions(+), 142 deletions(-)
---
diff --git a/src/easytag.c b/src/easytag.c
index 407af0c..a24791d 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -603,8 +603,11 @@ Create_Tag_Area (void)
GtkWidget *Table;
GtkWidget *Label;
GtkWidget *Icon;
+ GtkWidget *toolbar;
+ GtkToolItem *toolitem;
+ GIcon *icon;
+ GtkWidget *image;
GtkWidget *VBox;
- GtkWidget *hbox;
GList *focusable_widgets_list = NULL;
//GtkWidget *ScrollWindow;
//GtkTextBuffer *TextBuffer;
@@ -1118,7 +1121,7 @@ Create_Tag_Area (void)
gtk_tree_view_append_column(GTK_TREE_VIEW(PictureEntryView), column);
gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
- // Activate Drag'n'Drop for the PictureEntryView (and PictureAddButton)
+ /* Activate Drag'n'Drop for the PictureEntryView. */
gtk_drag_dest_set(GTK_WIDGET(PictureEntryView),
GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP,
drops, sizeof(drops) / sizeof(GtkTargetEntry),
@@ -1128,65 +1131,81 @@ Create_Tag_Area (void)
g_signal_connect(G_OBJECT(PictureEntryView),
"button_press_event",G_CALLBACK(Picture_Entry_View_Button_Pressed),NULL);
g_signal_connect(G_OBJECT(PictureEntryView),"key_press_event",
G_CALLBACK(Picture_Entry_View_Key_Pressed),NULL);
- // Picture action buttons
- hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 4);
- et_grid_attach_full (GTK_GRID (Table), hbox, 0, 1, 1, 1, FALSE, FALSE,
- TablePadding, TablePadding);
-
- PictureAddButton = gtk_button_new();
- Icon = gtk_image_new_from_stock(GTK_STOCK_ADD, GTK_ICON_SIZE_SMALL_TOOLBAR);
- gtk_container_add(GTK_CONTAINER(PictureAddButton),Icon);
- gtk_box_pack_start(GTK_BOX(hbox),PictureAddButton,FALSE,FALSE,0);
- gtk_widget_set_tooltip_text (PictureAddButton,
+ /* Picture action toolbar. */
+ toolbar = gtk_toolbar_new ();
+ gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS);
+ gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_MENU);
+ et_grid_attach_full (GTK_GRID (Table), toolbar, 0, 1, 1, 1, FALSE, FALSE,
+ TablePadding, TablePadding);
+
+ /* TODO: Make the icons use the symbolic variants. */
+ icon = g_themed_icon_new_with_default_fallbacks ("list-add");
+ image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_MENU);
+ add_image_toolitem = gtk_tool_button_new (image, NULL);
+ g_object_unref (icon);
+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar), add_image_toolitem, -1);
+ gtk_widget_set_tooltip_text (GTK_WIDGET (add_image_toolitem),
_("Add images to the tag"));
-
- PictureClearButton = gtk_button_new();
- Icon = gtk_image_new_from_stock(GTK_STOCK_REMOVE, GTK_ICON_SIZE_SMALL_TOOLBAR);
- gtk_container_add(GTK_CONTAINER(PictureClearButton),Icon);
- gtk_box_pack_start(GTK_BOX(hbox),PictureClearButton,FALSE,FALSE,0);
- gtk_widget_set_tooltip_text (PictureClearButton,
- _("Remove selected images"));
-
- PictureSaveButton = gtk_button_new();
- Icon = gtk_image_new_from_stock(GTK_STOCK_SAVE, GTK_ICON_SIZE_SMALL_TOOLBAR);
- gtk_container_add(GTK_CONTAINER(PictureSaveButton),Icon);
- gtk_box_pack_start(GTK_BOX(hbox),PictureSaveButton,FALSE,FALSE,0);
- gtk_widget_set_sensitive(GTK_WIDGET(PictureSaveButton), FALSE);
- gtk_widget_set_tooltip_text (PictureSaveButton,
+ g_signal_connect (G_OBJECT (add_image_toolitem), "clicked",
+ G_CALLBACK (Picture_Add_Button_Clicked), NULL);
+
+ /* Activate Drag'n'Drop for the add_image_toolitem. */
+ gtk_drag_dest_set (GTK_WIDGET (add_image_toolitem),
+ GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP,
+ drops, sizeof(drops) / sizeof(GtkTargetEntry),
+ GDK_ACTION_COPY);
+ g_signal_connect (G_OBJECT (add_image_toolitem), "drag-data-received",
+ G_CALLBACK (Tag_Area_Picture_Drag_Data), 0);
+
+ icon = g_themed_icon_new_with_default_fallbacks ("list-remove");
+ image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_MENU);
+ remove_image_toolitem = gtk_tool_button_new (image, NULL);
+ g_object_unref (icon);
+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar), remove_image_toolitem, -1);
+ gtk_widget_set_tooltip_text (GTK_WIDGET (remove_image_toolitem),
+ _("Remove selected images from the tag"));
+ gtk_widget_set_sensitive (GTK_WIDGET (remove_image_toolitem), FALSE);
+ g_signal_connect (G_OBJECT (remove_image_toolitem), "clicked",
+ G_CALLBACK (Picture_Clear_Button_Clicked), NULL);
+
+ toolitem = gtk_separator_tool_item_new ();
+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
+
+ icon = g_themed_icon_new_with_default_fallbacks ("document-save");
+ image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_MENU);
+ save_image_toolitem = gtk_tool_button_new (image, NULL);
+ g_object_unref (icon);
+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar), save_image_toolitem, -1);
+ gtk_widget_set_tooltip_text (GTK_WIDGET (save_image_toolitem),
_("Save the selected images to files"));
-
- PicturePropertiesButton = gtk_button_new();
- Icon = gtk_image_new_from_stock(GTK_STOCK_PROPERTIES, GTK_ICON_SIZE_SMALL_TOOLBAR);
- gtk_container_add(GTK_CONTAINER(PicturePropertiesButton),Icon);
- gtk_box_pack_start(GTK_BOX(hbox),PicturePropertiesButton,FALSE,FALSE,0);
- gtk_widget_set_sensitive(GTK_WIDGET(PicturePropertiesButton), FALSE);
- gtk_widget_set_tooltip_text (PicturePropertiesButton,
+ gtk_widget_set_sensitive (GTK_WIDGET (save_image_toolitem), FALSE);
+ g_signal_connect (G_OBJECT (save_image_toolitem), "clicked",
+ G_CALLBACK (Picture_Save_Button_Clicked), NULL);
+
+ icon = g_themed_icon_new_with_default_fallbacks ("document-properties");
+ image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_MENU);
+ image_properties_toolitem = gtk_tool_button_new (image, NULL);
+ g_object_unref (icon);
+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar), image_properties_toolitem, -1);
+ gtk_widget_set_tooltip_text (GTK_WIDGET (image_properties_toolitem),
_("Edit image properties"));
-
- PictureMButton = gtk_button_new ();
- Icon = gtk_image_new_from_icon_name ("insert-image",
- GTK_ICON_SIZE_SMALL_TOOLBAR);
- gtk_container_add (GTK_CONTAINER (PictureMButton), Icon);
- gtk_box_pack_start (GTK_BOX (hbox), PictureMButton, FALSE, FALSE,
- 0);
- gtk_widget_set_tooltip_text (PictureMButton,
+ gtk_widget_set_sensitive (GTK_WIDGET (image_properties_toolitem), FALSE);
+ g_signal_connect (G_OBJECT (image_properties_toolitem), "clicked",
+ G_CALLBACK (Picture_Properties_Button_Clicked), NULL);
+
+ toolitem = gtk_separator_tool_item_new ();
+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
+
+ icon = g_themed_icon_new_with_default_fallbacks ("insert-image");
+ image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_MENU);
+ apply_image_toolitem = gtk_tool_button_new (image, NULL);
+ g_object_unref (icon);
+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar), apply_image_toolitem, -1);
+ gtk_widget_set_tooltip_text (GTK_WIDGET (apply_image_toolitem),
_("Tag selected files with these images"));
-
- g_signal_connect(G_OBJECT(PictureClearButton), "clicked", G_CALLBACK(Picture_Clear_Button_Clicked),
NULL);
- g_signal_connect(G_OBJECT(PictureAddButton), "clicked", G_CALLBACK(Picture_Add_Button_Clicked),
NULL);
- g_signal_connect(G_OBJECT(PictureSaveButton), "clicked", G_CALLBACK(Picture_Save_Button_Clicked),
NULL);
- g_signal_connect(G_OBJECT(PicturePropertiesButton), "clicked",
G_CALLBACK(Picture_Properties_Button_Clicked), NULL);
- g_signal_connect (G_OBJECT (PictureMButton), "clicked",
+ g_signal_connect (G_OBJECT (apply_image_toolitem), "clicked",
G_CALLBACK (Mini_Button_Clicked), NULL);
- // Activate Drag'n'Drop for the PictureAddButton (and PictureEntryView)
- gtk_drag_dest_set(GTK_WIDGET(PictureAddButton),
- GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP,
- drops, sizeof(drops) / sizeof(GtkTargetEntry),
- GDK_ACTION_COPY);
- g_signal_connect(G_OBJECT(PictureAddButton),"drag_data_received",
G_CALLBACK(Tag_Area_Picture_Drag_Data), 0);
-
-
//Attach_Popup_Menu_To_Tag_Entries(GTK_ENTRY(PictureEntryView));
gtk_widget_show_all(TagFrame);
@@ -1610,7 +1629,7 @@ Mini_Button_Clicked (GObject *object)
else
msg = g_strdup(_("Removed encoder name from selected files."));
}
- else if (object==G_OBJECT(PictureMButton))
+ else if (object==G_OBJECT(apply_image_toolitem))
{
Picture *res = NULL, *pic, *prev_pic = NULL;
GtkTreeModel *model;
@@ -4111,29 +4130,6 @@ Tag_Area_Set_Sensitive (gboolean activate)
/* TAG Area (entries + buttons). */
gtk_widget_set_sensitive(gtk_bin_get_child(GTK_BIN(TagArea)),activate);
-
- /*// TAG Area
- gtk_widget_set_sensitive(GTK_WIDGET(TitleEntry), activate);
- gtk_widget_set_sensitive(GTK_WIDGET(ArtistEntry), activate);
- gtk_widget_set_sensitive(GTK_WIDGET(AlbumEntry), activate);
- gtk_widget_set_sensitive(GTK_WIDGET(DiscNumberEntry), activate);
- gtk_widget_set_sensitive(GTK_WIDGET(YearEntry), activate);
- gtk_widget_set_sensitive(GTK_WIDGET(TrackEntryCombo), activate);
- gtk_widget_set_sensitive(GTK_WIDGET(TrackTotalEntry), activate);
- gtk_widget_set_sensitive(GTK_WIDGET(CommentEntry), activate);
- gtk_widget_set_sensitive(GTK_WIDGET(GenreCombo), activate);
- gtk_widget_set_sensitive(GTK_WIDGET(PictureScrollWindow), activate);
- // Mini buttons
- gtk_widget_set_sensitive(GTK_WIDGET(TitleMButton), activate);
- gtk_widget_set_sensitive(GTK_WIDGET(DiscNumberMButton), activate);
- gtk_widget_set_sensitive(GTK_WIDGET(AlbumMButton), activate);
- gtk_widget_set_sensitive(GTK_WIDGET(YearMButton), activate);
- gtk_widget_set_sensitive(GTK_WIDGET(TrackMButton), activate);
- gtk_widget_set_sensitive(GTK_WIDGET(TrackMButtonSequence), activate);
- gtk_widget_set_sensitive(GTK_WIDGET(TrackMButtonNbrFiles), activate);
- gtk_widget_set_sensitive(GTK_WIDGET(CommentMButton), activate);
- gtk_widget_set_sensitive(GTK_WIDGET(GenreMButton), activate);
- gtk_widget_set_sensitive(GTK_WIDGET(PictureMButton), activate);*/
}
/*
@@ -4198,11 +4194,11 @@ void Tag_Area_Display_Controls (ET_File *ETFile)
gtk_widget_hide(GTK_WIDGET(EncodedByLabel));
gtk_widget_hide(GTK_WIDGET(EncodedByEntry));
gtk_widget_hide(GTK_WIDGET(PictureScrollWindow));
- gtk_widget_hide(GTK_WIDGET(PictureMButton));
- gtk_widget_hide(GTK_WIDGET(PictureClearButton));
- gtk_widget_hide(GTK_WIDGET(PictureAddButton));
- gtk_widget_hide(GTK_WIDGET(PictureSaveButton));
- gtk_widget_hide(GTK_WIDGET(PicturePropertiesButton));
+ gtk_widget_hide (GTK_WIDGET (apply_image_toolitem));
+ gtk_widget_hide (GTK_WIDGET (remove_image_toolitem));
+ gtk_widget_hide (GTK_WIDGET (add_image_toolitem));
+ gtk_widget_hide (GTK_WIDGET (save_image_toolitem));
+ gtk_widget_hide (GTK_WIDGET (image_properties_toolitem));
}else
{
gtk_widget_show(GTK_WIDGET(DiscNumberLabel));
@@ -4218,11 +4214,11 @@ void Tag_Area_Display_Controls (ET_File *ETFile)
gtk_widget_show(GTK_WIDGET(EncodedByLabel));
gtk_widget_show(GTK_WIDGET(EncodedByEntry));
gtk_widget_show(GTK_WIDGET(PictureScrollWindow));
- gtk_widget_show(GTK_WIDGET(PictureMButton));
- gtk_widget_show(GTK_WIDGET(PictureClearButton));
- gtk_widget_show(GTK_WIDGET(PictureAddButton));
- gtk_widget_show(GTK_WIDGET(PictureSaveButton));
- gtk_widget_show(GTK_WIDGET(PicturePropertiesButton));
+ gtk_widget_show (GTK_WIDGET (apply_image_toolitem));
+ gtk_widget_show (GTK_WIDGET (remove_image_toolitem));
+ gtk_widget_show (GTK_WIDGET (add_image_toolitem));
+ gtk_widget_show (GTK_WIDGET (save_image_toolitem));
+ gtk_widget_show (GTK_WIDGET (image_properties_toolitem));
}
break;
@@ -4241,11 +4237,11 @@ void Tag_Area_Display_Controls (ET_File *ETFile)
gtk_widget_show(GTK_WIDGET(EncodedByLabel));
gtk_widget_show(GTK_WIDGET(EncodedByEntry));
gtk_widget_show(GTK_WIDGET(PictureScrollWindow));
- gtk_widget_show(GTK_WIDGET(PictureMButton));
- gtk_widget_show(GTK_WIDGET(PictureClearButton));
- gtk_widget_show(GTK_WIDGET(PictureAddButton));
- gtk_widget_show(GTK_WIDGET(PictureSaveButton));
- gtk_widget_show(GTK_WIDGET(PicturePropertiesButton));
+ gtk_widget_show (GTK_WIDGET (apply_image_toolitem));
+ gtk_widget_show (GTK_WIDGET (remove_image_toolitem));
+ gtk_widget_show (GTK_WIDGET (add_image_toolitem));
+ gtk_widget_show (GTK_WIDGET (save_image_toolitem));
+ gtk_widget_show (GTK_WIDGET (image_properties_toolitem));
break;
#endif
@@ -4264,11 +4260,11 @@ void Tag_Area_Display_Controls (ET_File *ETFile)
gtk_widget_show(GTK_WIDGET(EncodedByLabel));
gtk_widget_show(GTK_WIDGET(EncodedByEntry));
gtk_widget_show(GTK_WIDGET(PictureScrollWindow));
- gtk_widget_show(GTK_WIDGET(PictureMButton));
- gtk_widget_show(GTK_WIDGET(PictureClearButton));
- gtk_widget_show(GTK_WIDGET(PictureAddButton));
- gtk_widget_show(GTK_WIDGET(PictureSaveButton));
- gtk_widget_show(GTK_WIDGET(PicturePropertiesButton));
+ gtk_widget_show (GTK_WIDGET (apply_image_toolitem));
+ gtk_widget_show (GTK_WIDGET (remove_image_toolitem));
+ gtk_widget_show (GTK_WIDGET (add_image_toolitem));
+ gtk_widget_show (GTK_WIDGET (save_image_toolitem));
+ gtk_widget_show (GTK_WIDGET (image_properties_toolitem));
break;
#endif
@@ -4286,11 +4282,11 @@ void Tag_Area_Display_Controls (ET_File *ETFile)
gtk_widget_show(GTK_WIDGET(EncodedByLabel));
gtk_widget_show(GTK_WIDGET(EncodedByEntry));
gtk_widget_hide(GTK_WIDGET(PictureScrollWindow));
- gtk_widget_hide(GTK_WIDGET(PictureMButton));
- gtk_widget_hide(GTK_WIDGET(PictureClearButton));
- gtk_widget_hide(GTK_WIDGET(PictureAddButton));
- gtk_widget_hide(GTK_WIDGET(PictureSaveButton));
- gtk_widget_hide(GTK_WIDGET(PicturePropertiesButton));
+ gtk_widget_hide (GTK_WIDGET (apply_image_toolitem));
+ gtk_widget_hide (GTK_WIDGET (remove_image_toolitem));
+ gtk_widget_hide (GTK_WIDGET (add_image_toolitem));
+ gtk_widget_hide (GTK_WIDGET (save_image_toolitem));
+ gtk_widget_hide (GTK_WIDGET (image_properties_toolitem));
break;
#ifdef ENABLE_MP4
@@ -4308,11 +4304,11 @@ void Tag_Area_Display_Controls (ET_File *ETFile)
gtk_widget_hide(GTK_WIDGET(EncodedByLabel));
gtk_widget_hide(GTK_WIDGET(EncodedByEntry));
gtk_widget_hide(GTK_WIDGET(PictureScrollWindow));
- gtk_widget_hide(GTK_WIDGET(PictureMButton));
- gtk_widget_hide(GTK_WIDGET(PictureClearButton));
- gtk_widget_hide(GTK_WIDGET(PictureAddButton));
- gtk_widget_hide(GTK_WIDGET(PictureSaveButton));
- gtk_widget_hide(GTK_WIDGET(PicturePropertiesButton));
+ gtk_widget_hide (GTK_WIDGET (apply_image_toolitem));
+ gtk_widget_hide (GTK_WIDGET (remove_image_toolitem));
+ gtk_widget_hide (GTK_WIDGET (add_image_toolitem));
+ gtk_widget_hide (GTK_WIDGET (save_image_toolitem));
+ gtk_widget_hide (GTK_WIDGET (image_properties_toolitem));
break;
#endif
@@ -4331,11 +4327,11 @@ void Tag_Area_Display_Controls (ET_File *ETFile)
gtk_widget_show(GTK_WIDGET(EncodedByLabel));
gtk_widget_show(GTK_WIDGET(EncodedByEntry));
gtk_widget_hide(GTK_WIDGET(PictureScrollWindow));
- gtk_widget_hide(GTK_WIDGET(PictureMButton));
- gtk_widget_hide(GTK_WIDGET(PictureClearButton));
- gtk_widget_hide(GTK_WIDGET(PictureAddButton));
- gtk_widget_hide(GTK_WIDGET(PictureSaveButton));
- gtk_widget_hide(GTK_WIDGET(PicturePropertiesButton));
+ gtk_widget_hide (GTK_WIDGET (apply_image_toolitem));
+ gtk_widget_hide (GTK_WIDGET (remove_image_toolitem));
+ gtk_widget_hide (GTK_WIDGET (add_image_toolitem));
+ gtk_widget_hide (GTK_WIDGET (save_image_toolitem));
+ gtk_widget_hide (GTK_WIDGET (image_properties_toolitem));
break;
#endif /* ENABLE_WAVPACK */
@@ -4354,11 +4350,11 @@ void Tag_Area_Display_Controls (ET_File *ETFile)
gtk_widget_hide(GTK_WIDGET(EncodedByLabel));
gtk_widget_hide(GTK_WIDGET(EncodedByEntry));
gtk_widget_hide(GTK_WIDGET(PictureScrollWindow));
- gtk_widget_hide(GTK_WIDGET(PictureMButton));
- gtk_widget_hide(GTK_WIDGET(PictureClearButton));
- gtk_widget_hide(GTK_WIDGET(PictureAddButton));
- gtk_widget_hide(GTK_WIDGET(PictureSaveButton));
- gtk_widget_hide(GTK_WIDGET(PicturePropertiesButton));
+ gtk_widget_hide (GTK_WIDGET (apply_image_toolitem));
+ gtk_widget_hide (GTK_WIDGET (remove_image_toolitem));
+ gtk_widget_hide (GTK_WIDGET (add_image_toolitem));
+ gtk_widget_hide (GTK_WIDGET (save_image_toolitem));
+ gtk_widget_hide (GTK_WIDGET (image_properties_toolitem));
break;
}
}
diff --git a/src/easytag.h b/src/easytag.h
index cca039c..95459b2 100644
--- a/src/easytag.h
+++ b/src/easytag.h
@@ -110,13 +110,13 @@ GtkWidget *EncodedByLabel;
// Mini buttons
GtkWidget *TrackMButtonSequence;
GtkWidget *TrackMButtonNbrFiles;
-GtkWidget *PictureMButton;
-// Other for picture
-GtkWidget *PictureClearButton;
-GtkWidget *PictureAddButton;
-GtkWidget *PictureSaveButton;
-GtkWidget *PicturePropertiesButton;
+/* Other for picture. */
+GtkToolItem *remove_image_toolitem;
+GtkToolItem *add_image_toolitem;
+GtkToolItem *save_image_toolitem;
+GtkToolItem *image_properties_toolitem;
+GtkToolItem *apply_image_toolitem;
GtkWidget *PictureScrollWindow;
GdkCursor *MouseCursor;
diff --git a/src/picture.c b/src/picture.c
index d65f4f7..8e5468a 100644
--- a/src/picture.c
+++ b/src/picture.c
@@ -108,17 +108,23 @@ void Tag_Area_Picture_Drag_Data (GtkWidget *widget, GdkDragContext *dc,
g_strfreev(uri_list);
}
-void Picture_Selection_Changed_cb (GtkTreeSelection *selection, gpointer data)
+void
+Picture_Selection_Changed_cb (GtkTreeSelection *selection, gpointer data)
{
- //if (gtk_tree_selection_count_selected_rows(GTK_TREE_SELECTION(selection)) == 1)
- //{
- gtk_widget_set_sensitive(GTK_WIDGET(PictureSaveButton), TRUE);
- gtk_widget_set_sensitive(GTK_WIDGET(PicturePropertiesButton), TRUE);
- //}else
- //{
- // gtk_widget_set_sensitive(GTK_WIDGET(PictureSaveButton), FALSE);
- // gtk_widget_set_sensitive(GTK_WIDGET(PicturePropertiesButton), FALSE);
- //}
+ if (gtk_tree_selection_count_selected_rows (GTK_TREE_SELECTION (selection)) >= 1)
+ {
+ gtk_widget_set_sensitive (GTK_WIDGET (remove_image_toolitem), TRUE);
+ gtk_widget_set_sensitive (GTK_WIDGET (save_image_toolitem), TRUE);
+ gtk_widget_set_sensitive (GTK_WIDGET (image_properties_toolitem),
+ TRUE);
+ }
+ else
+ {
+ gtk_widget_set_sensitive (GTK_WIDGET (remove_image_toolitem), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (save_image_toolitem), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (image_properties_toolitem),
+ FALSE);
+ }
}
void Picture_Clear_Button_Clicked (GObject *object)
@@ -166,10 +172,6 @@ void Picture_Clear_Button_Clicked (GObject *object)
n++;
}
g_list_free(refs);
-
- if (!n)
- // Delete all if no one was selected.
- PictureEntry_Clear();
}
/*
@@ -1211,10 +1213,10 @@ gboolean Picture_Entry_View_Button_Pressed (GtkTreeView *treeview, GdkEventButto
{
GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(PictureEntryView));
- if (gtk_tree_selection_count_selected_rows(GTK_TREE_SELECTION(selection)) != 0)
- Picture_Properties_Button_Clicked(G_OBJECT(PicturePropertiesButton));
+ if (gtk_tree_selection_count_selected_rows (GTK_TREE_SELECTION (selection)) >= 1)
+ Picture_Properties_Button_Clicked (G_OBJECT (image_properties_toolitem));
else
- Picture_Add_Button_Clicked(G_OBJECT(PictureAddButton));
+ Picture_Add_Button_Clicked (G_OBJECT (add_image_toolitem));
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]