All pastes #1506201 Raw Edit

data shared from file!

public diff v1 · immutable
#1506201 ·published 2009-07-24 21:20 UTC
rendered paste body
diff --git a/data/cheese-ui.xml b/data/cheese-ui.xmlindex 5407824..fc40347 100644--- a/data/cheese-ui.xml+++ b/data/cheese-ui.xml@@ -40,5 +40,6 @@     <menuitem action="SetAsAccountPhoto" />     <menuitem action="ExportToFSpot" />     <menuitem action="ExportToFlickr" />+    <menuitem action="ShareOnGwibber" />   </popup> </ui>diff --git a/src/cheese-window.c b/src/cheese-window.cindex 48974c4..e24cb1c 100644--- a/src/cheese-window.c+++ b/src/cheese-window.c@@ -160,6 +160,7 @@ typedef struct   GtkActionGroup *actions_sendto;   GtkActionGroup *actions_flickr;   GtkActionGroup *actions_fspot;+  GtkActionGroup *actions_gwibber;   GtkActionGroup *actions_mail;   GtkActionGroup *actions_main;   GtkActionGroup *actions_photo;@@ -440,6 +441,7 @@ cheese_window_cmd_close (GtkWidget *widget, CheeseWindow *cheese_window)   g_object_unref (cheese_window->actions_sendto);   g_object_unref (cheese_window->actions_flickr);   g_object_unref (cheese_window->actions_fspot);+  g_object_unref (cheese_window->actions_gwibber);   g_object_unref (cheese_window->actions_mail);   g_object_unref (cheese_window->actions_photo);   g_object_unref (cheese_window->actions_toggle);@@ -907,6 +909,22 @@ cheese_window_cmd_command_line (GtkAction *action, CheeseWindow *cheese_window)     command_line = g_strdup_printf ("f-spot -i %s", dirname);     g_free (dirname);   }+  else if (strcmp (action_name, "ShareOnGwibber") == 0)+  {+    // FIXME: Supporting only one file+    l = files;+    char *path = g_file_get_path (l->data);+    +    command_line = g_strdup_printf ("gwibber-share -w -f %s", path);  +    g_free (path);+    +    for (; l != NULL; l = l->next)+    {+      g_object_unref (l->data);+    }+    g_list_free (l);+    g_list_free (files);+  }   else if (strcmp (action_name, "ExportToFlickr") == 0)   {     char *path;@@ -1127,6 +1145,7 @@ cheese_window_button_press_event_cb (GtkWidget *iconview, GdkEventButton *event,         gtk_action_group_set_sensitive (cheese_window->actions_fspot, TRUE);         gtk_action_group_set_sensitive (cheese_window->actions_account_photo, TRUE);       }+      gtk_action_group_set_sensitive (cheese_window->actions_gwibber, TRUE);        gtk_menu_popup (GTK_MENU (cheese_window->thumb_view_popup_menu),                       NULL, iconview, NULL, NULL, button, event_time);@@ -1441,6 +1460,10 @@ static const GtkActionEntry action_entries_fspot[] = {   {"ExportToFSpot", NULL, N_("Export to F-_Spot"), NULL, NULL, G_CALLBACK (cheese_window_cmd_command_line)}, }; +static const GtkActionEntry action_entries_gwibber[] = {+  {"ShareOnGwibber", NULL, N_("Share on _Gwibber"), NULL, NULL, G_CALLBACK (cheese_window_cmd_command_line)},+};+ static const GtkActionEntry action_entries_flickr[] = {   {"ExportToFlickr", NULL, N_("Export to _Flickr"), NULL, NULL, G_CALLBACK (cheese_window_cmd_command_line)}, };@@ -1758,6 +1781,14 @@ cheese_window_create_window (CheeseWindow *cheese_window)   gtk_action_group_set_visible (cheese_window->actions_fspot, path != NULL);   g_free (path); +  cheese_window->actions_gwibber = cheese_window_action_group_new (cheese_window,+                                                                   "ActionsGwibber",+                                                                   action_entries_gwibber,+                                                                   G_N_ELEMENTS (action_entries_gwibber));+  path = g_find_program_in_path ("gwibber-share");+  gtk_action_group_set_visible (cheese_window->actions_gwibber, path != NULL);+  g_free (path);+    cheese_window->actions_flickr = cheese_window_action_group_new (cheese_window,                                                                   "ActionsFlickr",