[Xfce4-commits] <xfdesktop:master> Remove unused code

Eric Koegel noreply at xfce.org
Sun Aug 4 10:36:14 CEST 2013


Updating branch refs/heads/master
         to 9ca8aea6d217d72f95287b9750d152eca734a3eb (commit)
       from be0719f7c9e686ee52dc8a9a37f27e15f18203d1 (commit)

commit 9ca8aea6d217d72f95287b9750d152eca734a3eb
Author: Eric Koegel <eric.koegel at gmail.com>
Date:   Sun Mar 24 15:24:31 2013 +0300

    Remove unused code

 src/xfce-backdrop.c               |   89 ----------------------------
 src/xfce-backdrop.h               |    5 --
 src/xfdesktop-file-icon-manager.c |  116 -------------------------------------
 3 files changed, 210 deletions(-)

diff --git a/src/xfce-backdrop.c b/src/xfce-backdrop.c
index 1a63426..f209c50 100644
--- a/src/xfce-backdrop.c
+++ b/src/xfce-backdrop.c
@@ -68,8 +68,6 @@ struct _XfceBackdropPriv
     XfceBackdropImageStyle image_style;
     gchar *image_path;
 
-    gint brightness;
-
     gboolean cycle_backdrop;
     guint cycle_timer;
     guint cycle_timer_id;
@@ -102,52 +100,6 @@ static guint backdrop_signals[LAST_SIGNAL] = { 0, };
 /* helper functions */
 
 static GdkPixbuf *
-adjust_brightness(GdkPixbuf *src, gint amount)
-{
-    GdkPixbuf *newpix;
-    GdkPixdata pdata;
-    gboolean has_alpha = FALSE;
-    gint i, len;
-    GError *err = NULL;
-    
-    g_return_val_if_fail(src != NULL, NULL);
-    if(amount == 0)
-        return src;
-    
-    gdk_pixdata_from_pixbuf(&pdata, src, FALSE);
-    has_alpha = (pdata.pixdata_type & GDK_PIXDATA_COLOR_TYPE_RGBA);
-    if(pdata.length < 1)
-        len = pdata.width * pdata.height * (has_alpha?4:3);
-    else
-        len = pdata.length - GDK_PIXDATA_HEADER_LENGTH;
-    
-    for(i = 0; i < len; i++) {
-        gshort scaled;
-        
-        if(has_alpha && (i+1)%4)
-            continue;
-        
-        scaled = pdata.pixel_data[i] + amount;
-        if(scaled > 255)
-            scaled = 255;
-        if(scaled < 0)
-            scaled = 0;
-        pdata.pixel_data[i] = scaled;
-    }
-    
-    newpix = gdk_pixbuf_from_pixdata(&pdata, TRUE, &err);
-    if(!newpix) {
-        g_warning("%s: Unable to modify image brightness: %s", PACKAGE,
-                err->message);
-        g_error_free(err);
-        return src;
-    }
-    g_object_unref(G_OBJECT(src));
-    
-    return newpix;
-}
-
-static GdkPixbuf *
 create_solid(GdkColor *color,
              gint width,
              gint height,
@@ -389,10 +341,6 @@ xfce_backdrop_set_property(GObject *object,
                                              g_value_get_string(value));
             break;
 
-        case PROP_BRIGHTNESS:
-            xfce_backdrop_set_brightness(backdrop, g_value_get_int(value));
-            break;
-
         case PROP_BACKDROP_CYCLE_ENABLE:
             xfce_backdrop_set_cycle_backdrop(backdrop, g_value_get_boolean(value));
             break;
@@ -441,10 +389,6 @@ xfce_backdrop_get_property(GObject *object,
                                xfce_backdrop_get_image_filename(backdrop));
             break;
 
-        case PROP_BRIGHTNESS:
-            g_value_set_int(value, xfce_backdrop_get_brightness(backdrop));
-            break;
-
         case PROP_BACKDROP_CYCLE_ENABLE:
             g_value_set_boolean(value, xfce_backdrop_get_cycle_backdrop(backdrop));
             break;
@@ -701,33 +645,6 @@ xfce_backdrop_get_image_filename(XfceBackdrop *backdrop)
     return backdrop->priv->image_path;
 }
 
-/**
- * xfce_backdrop_set_brightness:
- * @backdrop: An #XfceBackdrop.
- * @brightness: A brightness value.
- *
- * Modifies the brightness of the backdrop using a value between -128 and 127.
- * A value of 0 indicates that the brightness should not be changed.  This value
- * is applied to the entire image, after compositing.
- **/
-void
-xfce_backdrop_set_brightness(XfceBackdrop *backdrop, gint brightness)
-{
-    g_return_if_fail(XFCE_IS_BACKDROP(backdrop));
-    
-    if(brightness != backdrop->priv->brightness) {
-        backdrop->priv->brightness = brightness;
-        g_signal_emit(G_OBJECT(backdrop), backdrop_signals[BACKDROP_CHANGED], 0);
-    }
-}
-
-gint
-xfce_backdrop_get_brightness(XfceBackdrop *backdrop)
-{
-    g_return_val_if_fail(XFCE_IS_BACKDROP(backdrop), 0);
-    return backdrop->priv->brightness;
-}
-
 static gboolean
 xfce_backdrop_timer(XfceBackdrop *backdrop)
 {
@@ -878,9 +795,6 @@ xfce_backdrop_get_pixbuf(XfceBackdrop *backdrop)
      *and if it doesn't then make the background the single colour*/
     if(!g_file_test(backdrop->priv->image_path, G_FILE_TEST_EXISTS) ||
        backdrop->priv->image_style == XFCE_BACKDROP_IMAGE_NONE) {
-        if(backdrop->priv->brightness != 0)
-            final_image = adjust_brightness(final_image, backdrop->priv->brightness);
-        
         return final_image;
     }
     
@@ -1006,9 +920,6 @@ xfce_backdrop_get_pixbuf(XfceBackdrop *backdrop)
     if(image)
         g_object_unref(G_OBJECT(image));
     
-    if(backdrop->priv->brightness != 0)
-        final_image = adjust_brightness(final_image, backdrop->priv->brightness);
-    
     return final_image;
 }
 
diff --git a/src/xfce-backdrop.h b/src/xfce-backdrop.h
index fbb01a9..ab26d45 100644
--- a/src/xfce-backdrop.h
+++ b/src/xfce-backdrop.h
@@ -111,11 +111,6 @@ void xfce_backdrop_set_image_filename    (XfceBackdrop *backdrop,
 G_CONST_RETURN gchar *xfce_backdrop_get_image_filename
                                          (XfceBackdrop *backdrop);
 
-
-void xfce_backdrop_set_brightness        (XfceBackdrop *backdrop,
-                                          gint brightness);
-gint xfce_backdrop_get_brightness        (XfceBackdrop *backdrop);
-
 void xfce_backdrop_set_cycle_backdrop    (XfceBackdrop *backdrop,
                                           gboolean cycle_backdrop);
 gboolean xfce_backdrop_get_cycle_backdrop(XfceBackdrop *backdrop);
diff --git a/src/xfdesktop-file-icon-manager.c b/src/xfdesktop-file-icon-manager.c
index d5e9ce3..1a2748e 100644
--- a/src/xfdesktop-file-icon-manager.c
+++ b/src/xfdesktop-file-icon-manager.c
@@ -1195,122 +1195,6 @@ xfdesktop_file_icon_menu_fill_template_menu(GtkWidget *menu,
   g_list_free(files);
 
   return have_templates;
-#if 0
-  dp = g_dir_open (absolute_path, 0, NULL);
-  g_free (absolute_path);
-
-  /* read the directory contents (if opened successfully) */
-  if (G_LIKELY (dp != NULL))
-    {
-      /* process all files within the directory */
-      for (;;)
-        {
-          /* read the name of the next file */
-          name = g_dir_read_name (dp);
-          if (G_UNLIKELY (name == NULL))
-            break;
-          else if (name[0] == '.')
-            continue;
-
-          /* determine the info for that file */
-          path = thunar_vfs_path_relative (templates_path, name);
-          info = thunar_vfs_info_new_for_path (path, NULL);
-          thunar_vfs_path_unref (path);
-
-          /* add the info (if any) to our list */
-          if (G_LIKELY (info != NULL))
-            info_list = g_list_insert_sorted (info_list, info, info_compare);
-        }
-
-      /* close the directory handle */
-      g_dir_close (dp);
-    }
-
-  /* check if we have any infos */
-  if (G_UNLIKELY (info_list == NULL))
-    return FALSE;
-
-  /* determine the icon theme for the menu */
-  icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (menu));
-
-  /* add menu items for all infos */
-  for (lp = info_list; lp != NULL; lp = lp->next)
-    {
-      /* determine the info */
-      info = lp->data;
-
-      /* check if we have a regular file or a directory here */
-      if (G_LIKELY (info->type == THUNAR_VFS_FILE_TYPE_REGULAR))
-        {
-          /* generate a label by stripping off the extension */
-          label = g_strdup (info->display_name);
-          dot = g_utf8_strrchr (label, -1, '.');
-          if (G_LIKELY (dot != NULL))
-            *dot = '\0';
-
-          /* allocate a new menu item */
-          item = gtk_image_menu_item_new_with_label (label);
-          g_object_set_data_full (G_OBJECT (item), I_("thunar-vfs-info"), thunar_vfs_info_ref (info), (GDestroyNotify) thunar_vfs_info_unref);
-          g_signal_connect (G_OBJECT (item), "activate",
-                            G_CALLBACK (xfdesktop_file_icon_template_item_activated),
-                            fmanager);
-          gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-          gtk_widget_show (item);
-
-          /* lookup the icon for the mime type of that file */
-          icon_name = thunar_vfs_mime_info_lookup_icon_name (info->mime_info, icon_theme);
-
-          /* generate an image based on the named icon */
-          image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
-          gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
-          gtk_widget_show (image);
-
-          /* cleanup */
-          g_free (label);
-          
-          have_templates = TRUE;
-        }
-      else if (info->type == THUNAR_VFS_FILE_TYPE_DIRECTORY)
-        {
-          /* allocate a new submenu for the directory */
-          submenu = gtk_menu_new ();
-          g_object_ref_sink (G_OBJECT (submenu));
-          gtk_menu_set_screen (GTK_MENU (submenu), gtk_widget_get_screen (menu));
-
-          /* fill the submenu from the folder contents */
-          have_templates = xfdesktop_file_icon_menu_fill_template_menu(submenu,
-                                                                       info->path,
-                                                                       fmanager)
-                           || have_templates;
-
-          /* check if any items were added to the submenu */
-          if (G_LIKELY (GTK_MENU_SHELL (submenu)->children != NULL))
-            {
-              /* hook up the submenu */
-              item = gtk_image_menu_item_new_with_label (info->display_name);
-              gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), submenu);
-              gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-              gtk_widget_show (item);
-
-              /* lookup the icon for the mime type of that file */
-              icon_name = thunar_vfs_mime_info_lookup_icon_name (info->mime_info, icon_theme);
-
-              /* generate an image based on the named icon */
-              image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
-              gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
-              gtk_widget_show (image);
-            }
-
-          /* cleanup */
-          g_object_unref (G_OBJECT (submenu));
-        }
-    }
-
-  /* release the info list */
-  thunar_vfs_info_list_free (info_list);
-#endif
-  
-  return have_templates;
 }
 
 #ifdef HAVE_THUNARX


More information about the Xfce4-commits mailing list