Update menu sensitivity

This commit is contained in:
Matthias Clasen 2009-08-22 07:39:39 +00:00
parent 39bf463eb1
commit cd9a709e3e
2 changed files with 112 additions and 1 deletions

View File

@ -1,6 +1,6 @@
Name: cheese Name: cheese
Version: 2.27.90 Version: 2.27.90
Release: 2%{?dist} Release: 3%{?dist}
Summary: Application for taking pictures and movies from a webcam Summary: Application for taking pictures and movies from a webcam
Group: Amusements/Graphics Group: Amusements/Graphics
@ -37,6 +37,9 @@ Requires(preun): GConf2
# #
Patch0: fix-schemas.patch Patch0: fix-schemas.patch
# http://bugzilla.gnome.org/show_bug.cgi?id=592663
Patch1: trash-menu.patch
%description %description
Cheese is a Photobooth-inspired GNOME application for taking pictures and Cheese is a Photobooth-inspired GNOME application for taking pictures and
videos from a webcam. It can also apply fancy graphical effects. videos from a webcam. It can also apply fancy graphical effects.
@ -44,6 +47,7 @@ videos from a webcam. It can also apply fancy graphical effects.
%prep %prep
%setup -q %setup -q
%patch0 -p1 -b .fix-schemas %patch0 -p1 -b .fix-schemas
%patch1 -p1 -b .trash-menu
%build %build
%configure %configure
@ -126,6 +130,9 @@ fi
%{_datadir}/dbus-1/services/org.gnome.Cheese.service %{_datadir}/dbus-1/services/org.gnome.Cheese.service
%changelog %changelog
* Sat Aug 22 2009 Matthias Clasen <mclasen@redhat.com> 2.27.90-3
- Update sensitivity of menu items
* Fri Aug 14 2009 Matthias Clasen <mclasen@redhat.com> 2.27.90-2 * Fri Aug 14 2009 Matthias Clasen <mclasen@redhat.com> 2.27.90-2
- Fix schemas file syntax - Fix schemas file syntax

104
trash-menu.patch Normal file
View File

@ -0,0 +1,104 @@
--- cheese-2.27.90/src/cheese-window.c 2009-08-10 16:03:17.000000000 -0400
+++ hacked/src/cheese-window.c 2009-08-22 03:32:26.482193815 -0400
@@ -172,6 +172,7 @@
GtkActionGroup *actions_burst;
GtkActionGroup *actions_fullscreen;
GtkActionGroup *actions_wide_mode;
+ GtkActionGroup *actions_trash;
GtkUIManager *ui_manager;
@@ -559,6 +560,7 @@
{
g_object_unref (cheese_window->webcam);
g_object_unref (cheese_window->actions_main);
+ g_object_unref (cheese_window->actions_trash);
g_object_unref (cheese_window->actions_account_photo);
g_object_unref (cheese_window->actions_countdown);
g_object_unref (cheese_window->actions_effects);
@@ -1182,6 +1184,39 @@
}
}
+static void
+cheese_window_thumbnails_changed (GtkTreeModel *model,
+ CheeseWindow *cheese_window)
+{
+ GtkTreeIter iter;
+
+ if (gtk_tree_model_get_iter_first (model, &iter))
+ {
+ gtk_action_group_set_sensitive (cheese_window->actions_trash, TRUE);
+ }
+ else
+ {
+ gtk_action_group_set_sensitive (cheese_window->actions_trash, FALSE);
+ }
+}
+
+static void
+cheese_window_thumbnail_inserted (GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ CheeseWindow *cheese_window)
+{
+ cheese_window_thumbnails_changed (model, cheese_window);
+}
+
+static void
+cheese_window_thumbnail_deleted (GtkTreeModel *model,
+ GtkTreePath *path,
+ CheeseWindow *cheese_window)
+{
+ cheese_window_thumbnails_changed (model, cheese_window);
+}
+
static gboolean
cheese_window_button_press_event_cb (GtkWidget *iconview, GdkEventButton *event,
CheeseWindow *cheese_window)
@@ -1549,8 +1584,6 @@
{"Cheese", NULL, N_("_Cheese") },
{"Edit", NULL, N_("_Edit") },
- {"RemoveAll", NULL, N_("Move All to Trash"), NULL, NULL,
- G_CALLBACK (cheese_window_move_all_media_to_trash)},
{"Help", NULL, N_("_Help") },
@@ -1560,6 +1593,11 @@
{"About", GTK_STOCK_ABOUT, NULL, NULL, NULL, G_CALLBACK (cheese_window_cmd_about)},
};
+static const GtkActionEntry action_entries_trash[] = {
+ {"RemoveAll", NULL, N_("Move All to Trash"), NULL, NULL,
+ G_CALLBACK (cheese_window_move_all_media_to_trash)},
+};
+
static const GtkToggleActionEntry action_entries_countdown[] = {
{"Countdown", NULL, N_("Countdown"), NULL, NULL, G_CALLBACK (cheese_window_set_countdown), FALSE},
};
@@ -1878,6 +1943,10 @@
"ActionsMain",
action_entries_main,
G_N_ELEMENTS (action_entries_main));
+ cheese_window->actions_trash = cheese_window_action_group_new (cheese_window,
+ "ActionsTrash",
+ action_entries_trash,
+ G_N_ELEMENTS (action_entries_trash));
cheese_window->actions_toggle = cheese_window_radio_action_group_new (cheese_window,
"ActionsRadio",
action_entries_toggle,
@@ -2041,6 +2110,13 @@
G_CALLBACK (cheese_window_selection_changed_cb), cheese_window);
g_signal_connect (cheese_window->thumb_view, "button_press_event",
G_CALLBACK (cheese_window_button_press_event_cb), cheese_window);
+
+ g_signal_connect (gtk_icon_view_get_model (GTK_ICON_VIEW (cheese_window->thumb_view)), "row-inserted",
+ G_CALLBACK (cheese_window_thumbnail_inserted), cheese_window);
+ g_signal_connect (gtk_icon_view_get_model (GTK_ICON_VIEW (cheese_window->thumb_view)), "row-deleted",
+ G_CALLBACK (cheese_window_thumbnail_deleted), cheese_window);
+
+ cheese_window_thumbnails_changed (gtk_icon_view_get_model (GTK_ICON_VIEW (cheese_window->thumb_view)), cheese_window);
}
void