[Goodies-commits] r5848 - in xfce4-screenshooter-plugin/trunk: . lib panel-plugin src

Jerome Guelfucci jeromeg at xfce.org
Tue Oct 28 17:11:44 CET 2008


Author: jeromeg
Date: 2008-10-28 16:11:44 +0000 (Tue, 28 Oct 2008)
New Revision: 5848

Modified:
   xfce4-screenshooter-plugin/trunk/ChangeLog
   xfce4-screenshooter-plugin/trunk/lib/screenshooter-utils.c
   xfce4-screenshooter-plugin/trunk/lib/screenshooter-utils.h
   xfce4-screenshooter-plugin/trunk/panel-plugin/screenshooter-plugin.c
   xfce4-screenshooter-plugin/trunk/src/main.c
Log:
  * lib/screenshooter-utils.{c,h}: add the "screenshooter_" prefix before
    (take_screenshot) and (save_screenshot).
  * src/main.c: use the new function names in (main).
  * panel-plugin/screenshooter-plugin.c:
    - use new function names.
    - add a missing prototype.
    - clean the indentation of prototypes.
    - add a "cb_" before all callback functions names.
    - use a "screenshooter_plugin_" prefix for other functions.


Modified: xfce4-screenshooter-plugin/trunk/ChangeLog
===================================================================
--- xfce4-screenshooter-plugin/trunk/ChangeLog	2008-10-28 13:27:02 UTC (rev 5847)
+++ xfce4-screenshooter-plugin/trunk/ChangeLog	2008-10-28 16:11:44 UTC (rev 5848)
@@ -1,5 +1,17 @@
 2008-10-28 jeromeg
 
+  * lib/screenshooter-utils.{c,h}: add the "screenshooter_" prefix before
+    (take_screenshot) and (save_screenshot).
+  * src/main.c: use the new function names in (main).
+  * panel-plugin/screenshooter-plugin.c:
+    - use new function names.
+    - add a missing prototype.
+    - clean the indentation of prototypes.
+    - add a "cb_" before all callback functions names.
+    - use a "screenshooter_plugin_" prefix for other functions.
+
+2008-10-28 jeromeg
+
   * src/xfce4-screenshooter.desktop.in.in: change the item name.
   * po/:
     - update-po.

Modified: xfce4-screenshooter-plugin/trunk/lib/screenshooter-utils.c
===================================================================
--- xfce4-screenshooter-plugin/trunk/lib/screenshooter-utils.c	2008-10-28 13:27:02 UTC (rev 5847)
+++ xfce4-screenshooter-plugin/trunk/lib/screenshooter-utils.c	2008-10-28 16:11:44 UTC (rev 5848)
@@ -57,8 +57,8 @@
 
 
 
-/* Generates filename Screenshot-n.png where n is the first integer greater than 
-0 so that Screenshot-n.jpg does not exist in the folder whose URI is *uri.
+/* Generates filename Screenshot-n.png (where n is the first integer greater than 
+0) so that Screenshot-n.jpg does not exist in the folder whose URI is *uri.
 *uri: the uri of the folder for which the filename should be generated.
 returns: a filename verifying the above conditions or NULL if *uri == NULL.
 */
@@ -126,7 +126,8 @@
 *sd: a ScreenshotData struct.
 returns: the screenshot in a *GdkPixbuf.
 */
-GdkPixbuf *take_screenshot (gint mode, gint delay)
+GdkPixbuf *screenshooter_take_screenshot (gint       mode, 
+                                          gint       delay)
 {
   GdkPixbuf *screenshot;
   GdkWindow *window = NULL;
@@ -201,8 +202,9 @@
 /* Saves the screenshot according to the options in sd. 
 *screenshot: a GdkPixbuf containing our screenshot
 *sd: a ScreenshotData struct containing the save options.*/
-void save_screenshot (GdkPixbuf *screenshot, gboolean show_save_dialog,
-                      gchar *default_dir)
+void screenshooter_save_screenshot (GdkPixbuf      *screenshot, 
+                                    gboolean        show_save_dialog,
+                                    gchar          *default_dir)
 {
   GdkPixbuf *thumbnail;
   gchar *filename = NULL;
@@ -278,7 +280,9 @@
 
 
 void
-screenshooter_read_rc_file (gchar *file, ScreenshotData *sd, gboolean dir_only)
+screenshooter_read_rc_file (gchar               *file, 
+                            ScreenshotData      *sd, 
+                            gboolean             dir_only)
 {
   XfceRc *rc;
   gint delay = 0;
@@ -320,7 +324,8 @@
 
 
 void
-screenshooter_write_rc_file (gchar *file, ScreenshotData *sd)
+screenshooter_write_rc_file (gchar               *file, 
+                             ScreenshotData      *sd)
 {
   XfceRc *rc;
 

Modified: xfce4-screenshooter-plugin/trunk/lib/screenshooter-utils.h
===================================================================
--- xfce4-screenshooter-plugin/trunk/lib/screenshooter-utils.h	2008-10-28 13:27:02 UTC (rev 5847)
+++ xfce4-screenshooter-plugin/trunk/lib/screenshooter-utils.h	2008-10-28 16:11:44 UTC (rev 5848)
@@ -51,9 +51,11 @@
 }
 ScreenshotData;
 
-GdkPixbuf *take_screenshot       (gint                  mode, 
+GdkPixbuf 
+*screenshooter_take_screenshot   (gint                  mode, 
                                   gint                  delay);
-void save_screenshot             (GdkPixbuf            *screenshot, 
+void 
+screenshooter_save_screenshot    (GdkPixbuf            *screenshot, 
                                   gboolean              show_save_dialog,
                                   gchar                *default_dir);
 void screenshooter_read_rc_file  (gchar                *file, 

Modified: xfce4-screenshooter-plugin/trunk/panel-plugin/screenshooter-plugin.c
===================================================================
--- xfce4-screenshooter-plugin/trunk/panel-plugin/screenshooter-plugin.c	2008-10-28 13:27:02 UTC (rev 5847)
+++ xfce4-screenshooter-plugin/trunk/panel-plugin/screenshooter-plugin.c	2008-10-28 16:11:44 UTC (rev 5848)
@@ -56,24 +56,49 @@
 
 
 /* Protoypes */
+                                   
+static void 
+screenshooter_plugin_construct       (XfcePanelPlugin      *plugin);
 
-static void screenshot_properties_dialog (XfcePanelPlugin *plugin,
-                                          PluginData *pd);
-static void screenshot_construct (XfcePanelPlugin *plugin);
-static gboolean screenshot_set_size (XfcePanelPlugin *plugin, 
-                                     int size, PluginData *pd);
-static void screenshot_free_data (XfcePanelPlugin *plugin, 
-                                  PluginData *pd);
-static void button_clicked (GtkWidget *button, PluginData *pd);
-static void screenshot_style_set (XfcePanelPlugin *plugin, gpointer ignored,
-                                  PluginData *pd);
-static void screenshot_read_rc_file (XfcePanelPlugin *plugin, PluginData *pd);                
-static void screenshot_write_rc_file (XfcePanelPlugin *plugin, PluginData *pd);
-                                        
+static void 
+screenshooter_plugin_read_rc_file    (XfcePanelPlugin      *plugin, 
+                                      PluginData           *pd);  
+              
+static void 
+screenshooter_plugin_write_rc_file   (XfcePanelPlugin      *plugin, 
+                                      PluginData           *pd);
+
+static gboolean 
+cb_set_size                          (XfcePanelPlugin      *plugin, 
+                                      int                   size, 
+                                      PluginData           *pd);
+                                   
+static void 
+cb_properties_dialog                 (XfcePanelPlugin      *plugin,
+                                      PluginData           *pd);
+                                      
+static void
+cb_dialog_response                   (GtkWidget            *dlg, 
+                                      int                   reponse,
+                                      PluginData           *pd);
+                                   
+static void 
+cb_free_data                         (XfcePanelPlugin      *plugin, 
+                                      PluginData           *pd);
+                                  
+static void 
+cb_button_clicked                    (GtkWidget            *button, 
+                                      PluginData           *pd);
+
+static void
+cb_style_set                         (XfcePanelPlugin      *plugin, 
+                                      gpointer              ignored,
+                                      PluginData           *pd);
+                                       
                                               
 
 /* Register the panel plugin */
-XFCE_PANEL_PLUGIN_REGISTER_INTERNAL (screenshot_construct);
+XFCE_PANEL_PLUGIN_REGISTER_INTERNAL (screenshooter_plugin_construct);
 
 
 
@@ -85,7 +110,7 @@
 Returns TRUE if succesful. 
 */
 static gboolean
-screenshot_set_size (XfcePanelPlugin *plugin, int size, PluginData *pd)
+cb_set_size (XfcePanelPlugin *plugin, int size, PluginData *pd)
 {
   GdkPixbuf *pb;
   int width = size - 2 - 2 * MAX (pd->button->style->xthickness,
@@ -106,7 +131,7 @@
 pd: the associated PluginData. 
 */
 static void
-screenshot_free_data (XfcePanelPlugin *plugin, PluginData *pd)
+cb_free_data (XfcePanelPlugin *plugin, PluginData *pd)
 {
   if (pd->style_id)
   	g_signal_handler_disconnect (plugin, pd->style_id);
@@ -124,7 +149,7 @@
 pd: the PluginData storing the options for taking the screenshot.
 */
 static void
-button_clicked (GtkWidget *button, PluginData *pd)
+cb_button_clicked (GtkWidget *button, PluginData *pd)
 {
   GdkPixbuf *screenshot;
     
@@ -133,10 +158,10 @@
 	gtk_widget_set_sensitive (GTK_WIDGET (pd->button), FALSE);
 
   /* Get the screenshot */
-	screenshot = take_screenshot (pd->sd->mode, pd->sd->delay);
+	screenshot = screenshooter_take_screenshot (pd->sd->mode, pd->sd->delay);
 
-  save_screenshot (screenshot, pd->sd->show_save_dialog, 
-                   pd->sd->screenshot_dir);
+  screenshooter_save_screenshot (screenshot, pd->sd->show_save_dialog, 
+                                 pd->sd->screenshot_dir);
   
 	gtk_widget_set_sensitive (GTK_WIDGET (pd->button), TRUE);
 	
@@ -150,10 +175,10 @@
 pd: the associated PluginData.
 */
 static void
-screenshot_style_set (XfcePanelPlugin *plugin, gpointer ignored,
+cb_style_set (XfcePanelPlugin *plugin, gpointer ignored,
                        PluginData *pd)
 {
-  screenshot_set_size (plugin, xfce_panel_plugin_get_size (plugin), pd);
+  cb_set_size (plugin, xfce_panel_plugin_get_size (plugin), pd);
 }
 
 
@@ -163,7 +188,7 @@
 pd: the associated PluginData.
 */
 static void
-screenshot_read_rc_file (XfcePanelPlugin *plugin, PluginData *pd)
+screenshooter_plugin_read_rc_file (XfcePanelPlugin *plugin, PluginData *pd)
 {
   screenshooter_read_rc_file (xfce_panel_plugin_lookup_rc_file (plugin), 
                               pd->sd, 
@@ -177,7 +202,7 @@
 pd: the associated PluginData.
 */
 static void
-screenshot_write_rc_file (XfcePanelPlugin *plugin, PluginData *pd)
+screenshooter_plugin_write_rc_file (XfcePanelPlugin *plugin, PluginData *pd)
 {
   screenshooter_write_rc_file (xfce_panel_plugin_save_location (plugin, TRUE), 
                                pd->sd);  
@@ -190,8 +215,8 @@
    Unblock the plugin contextual menu.
    Save the options in the rc file.*/
 static void
-screenshot_dialog_response (GtkWidget *dlg, int reponse,
-                            PluginData *pd)
+cb_dialog_response (GtkWidget *dlg, int reponse,
+                    PluginData *pd)
 {
   g_object_set_data (G_OBJECT (pd->plugin), "dialog", NULL);
 
@@ -213,14 +238,14 @@
   
   /* Unblock the menu and save options */
   xfce_panel_plugin_unblock_menu (pd->plugin);
-  screenshot_write_rc_file (pd->plugin, pd);
+  screenshooter_plugin_write_rc_file (pd->plugin, pd);
 }
 
 
 
 /* Properties dialog to set the plugin options */
 static void
-screenshot_properties_dialog (XfcePanelPlugin *plugin, PluginData *pd)
+cb_properties_dialog (XfcePanelPlugin *plugin, PluginData *pd)
 {
   GtkWidget *dlg;
   
@@ -232,7 +257,7 @@
   
   g_object_set_data (G_OBJECT (plugin), "dialog", dlg);
 
-  g_signal_connect (dlg, "response", G_CALLBACK (screenshot_dialog_response),
+  g_signal_connect (dlg, "response", G_CALLBACK (cb_dialog_response),
                     pd);
 
   gtk_widget_show (dlg);
@@ -242,7 +267,7 @@
 
 /* Create the plugin button */
 static void
-screenshot_construct (XfcePanelPlugin *plugin)
+screenshooter_plugin_construct (XfcePanelPlugin *plugin)
 {
   /* Initialise the data structs */
   PluginData *pd = g_new0 (PluginData, 1);
@@ -255,7 +280,7 @@
   pd->plugin = plugin;
 
   /* Read the options */
-  screenshot_read_rc_file (plugin, pd);
+  screenshooter_plugin_read_rc_file (plugin, pd);
   
   /* Create the panel button */
   pd->button = xfce_create_panel_button ();
@@ -285,20 +310,20 @@
   
   /* Set the callbacks */
   g_signal_connect (pd->button, "clicked",
-                    G_CALLBACK (button_clicked), pd);
+                    G_CALLBACK (cb_button_clicked), pd);
 
   g_signal_connect (plugin, "free-data",
-                    G_CALLBACK (screenshot_free_data), pd);
+                    G_CALLBACK (cb_free_data), pd);
 
   g_signal_connect (plugin, "size-changed",
-                    G_CALLBACK (screenshot_set_size), pd);
+                    G_CALLBACK (cb_set_size), pd);
 
   pd->style_id =
       g_signal_connect (plugin, "style-set",
-                        G_CALLBACK (screenshot_style_set), pd);
+                        G_CALLBACK (cb_style_set), pd);
 
   xfce_panel_plugin_menu_show_configure (plugin);
   g_signal_connect (plugin, "configure-plugin",
-                    G_CALLBACK (screenshot_properties_dialog), pd);
+                    G_CALLBACK (cb_properties_dialog), pd);
 }
-XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL (screenshot_construct);
+XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL (screenshooter_plugin_construct);

Modified: xfce4-screenshooter-plugin/trunk/src/main.c
===================================================================
--- xfce4-screenshooter-plugin/trunk/src/main.c	2008-10-28 13:27:02 UTC (rev 5847)
+++ xfce4-screenshooter-plugin/trunk/src/main.c	2008-10-28 16:11:44 UTC (rev 5848)
@@ -169,8 +169,9 @@
   /* If a mode cli option is given, take the screenshot accordingly. */
   if (fullscreen || window)
     {
-      screenshot = take_screenshot (sd->mode, sd->delay);
-      save_screenshot (screenshot, sd->show_save_dialog, sd->screenshot_dir);
+      screenshot = screenshooter_take_screenshot (sd->mode, sd->delay);
+      screenshooter_save_screenshot (screenshot, sd->show_save_dialog, 
+                                     sd->screenshot_dir);
     
       g_object_unref (screenshot);
     }
@@ -194,9 +195,9 @@
       
       if (response == GTK_RESPONSE_OK)
         {
-          screenshot = take_screenshot (sd->mode, sd->delay);
-          save_screenshot (screenshot, sd->show_save_dialog, 
-                           sd->screenshot_dir);
+          screenshot = screenshooter_take_screenshot (sd->mode, sd->delay);
+          screenshooter_save_screenshot (screenshot, sd->show_save_dialog, 
+                                         sd->screenshot_dir);
           g_object_unref (screenshot);
           
           screenshooter_write_rc_file (rc_file, sd);




More information about the Goodies-commits mailing list