From 7dd50ac5969408e7f1fd1d452c13537a45731c58 Mon Sep 17 00:00:00 2001 From: Jasmine Hassan Date: Fri, 2 Nov 2012 22:32:24 +0200 Subject: [property-browser] use gtk_label_set_attributes, obsolete eel_gtk_label_set_scale Not upstream because property-browser removed. But as in upstream, eel_gtk_label_set_scale() is going away in next eel-gtk-extensions.[ch] cleanup. --- src/caja-property-browser.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/caja-property-browser.c') diff --git a/src/caja-property-browser.c b/src/caja-property-browser.c index c74177d3..92de4738 100644 --- a/src/caja-property-browser.c +++ b/src/caja-property-browser.c @@ -228,6 +228,7 @@ caja_property_browser_init (GtkObject *object) GtkWidget *widget, *temp_box, *temp_hbox, *temp_frame, *vbox; GtkWidget *temp_button; GtkWidget *viewport; + PangoAttrList *attrs; char *temp_str; property_browser = CAJA_PROPERTY_BROWSER (object); @@ -316,9 +317,12 @@ caja_property_browser_init (GtkObject *object) gtk_container_add(GTK_CONTAINER(temp_frame), temp_hbox); /* add the title label */ + attrs = pango_attr_list_new (); + pango_attr_list_insert (attrs, pango_attr_scale_new (PANGO_SCALE_X_LARGE)); + pango_attr_list_insert (attrs, pango_attr_weight_new (PANGO_WEIGHT_BOLD)); property_browser->details->title_label = gtk_label_new (""); - eel_gtk_label_set_scale (GTK_LABEL (property_browser->details->title_label), PANGO_SCALE_X_LARGE); - eel_gtk_label_make_bold (GTK_LABEL (property_browser->details->title_label)); + gtk_label_set_attributes (GTK_LABEL (property_browser->details->title_label), attrs); + pango_attr_list_unref (attrs); gtk_widget_show(property_browser->details->title_label); gtk_box_pack_start (GTK_BOX(temp_hbox), property_browser->details->title_label, FALSE, FALSE, 0); -- cgit v1.2.1 From a8ffe6f91bb6d67410fe886ef90deef1d5639aa9 Mon Sep 17 00:00:00 2001 From: Jasmine Hassan Date: Sat, 27 Oct 2012 09:45:11 +0200 Subject: [bkmrks-win/prop-brwsr] don't use eel_gtk_window_*_close_accelerator() bk-window: don't use _event_is_close_accelerator() http://git.gnome.org/browse/nautilus/commit/?id=cab696f7d760f5ee63f0a623b13d27b76d2f2d00 Also needed to drop eel_gtk_window_set_up_close_accelerator() instance in src/caja-property-browser.c --- src/caja-property-browser.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/caja-property-browser.c') diff --git a/src/caja-property-browser.c b/src/caja-property-browser.c index 92de4738..8c8cea9d 100644 --- a/src/caja-property-browser.c +++ b/src/caja-property-browser.c @@ -256,7 +256,6 @@ caja_property_browser_init (GtkObject *object) gtk_window_set_title (GTK_WINDOW (widget), _("Backgrounds and Emblems")); gtk_window_set_wmclass (GTK_WINDOW (widget), "property_browser", "Caja"); gtk_window_set_type_hint (GTK_WINDOW (widget), GDK_WINDOW_TYPE_HINT_DIALOG); - eel_gtk_window_set_up_close_accelerator (GTK_WINDOW (widget)); /* create the main vbox. */ vbox = gtk_vbox_new (FALSE, 12); -- cgit v1.2.1 From 5d46e2a7bed077a365f4df32e8ef2ef20323871c Mon Sep 17 00:00:00 2001 From: Jasmine Hassan Date: Sat, 3 Nov 2012 18:26:46 +0200 Subject: [property-browser] Don't use GtkObject nor eel-gtk-macros --- src/caja-property-browser.c | 149 ++++++++++++++++++++------------------------ 1 file changed, 69 insertions(+), 80 deletions(-) (limited to 'src/caja-property-browser.c') diff --git a/src/caja-property-browser.c b/src/caja-property-browser.c index 8c8cea9d..5fb5c249 100644 --- a/src/caja-property-browser.c +++ b/src/caja-property-browser.c @@ -35,13 +35,10 @@ #include #include #include -#include #include -#include #include #include #include -#include #include #include #include @@ -122,9 +119,6 @@ struct CajaPropertyBrowserDetails gboolean has_local; }; -static void caja_property_browser_class_init (GtkObjectClass *object_klass); -static void caja_property_browser_init (GtkObject *object); -static void caja_property_browser_destroy (GtkObject *object); static void caja_property_browser_update_contents (CajaPropertyBrowser *property_browser); static void caja_property_browser_set_category (CajaPropertyBrowser *property_browser, const char *new_category); @@ -200,41 +194,85 @@ static GtkTargetEntry drag_types[] = }; -EEL_CLASS_BOILERPLATE (CajaPropertyBrowser, - caja_property_browser, - GTK_TYPE_WINDOW) +G_DEFINE_TYPE (CajaPropertyBrowser, caja_property_browser, GTK_TYPE_WINDOW) + + +/* Destroy the three dialogs for adding patterns/colors/emblems if any of them + exist. */ +static void +caja_property_browser_destroy_dialogs (CajaPropertyBrowser *property_browser) +{ + if (property_browser->details->patterns_dialog) + { + gtk_widget_destroy (property_browser->details->patterns_dialog); + property_browser->details->patterns_dialog = NULL; + } + if (property_browser->details->colors_dialog) + { + gtk_widget_destroy (property_browser->details->colors_dialog); + property_browser->details->colors_dialog = NULL; + } + if (property_browser->details->emblems_dialog) + { + gtk_widget_destroy (property_browser->details->emblems_dialog); + property_browser->details->emblems_dialog = NULL; + } +} -/* initializing the class object by installing the operations we override */ static void -caja_property_browser_class_init (GtkObjectClass *object_klass) +caja_property_browser_dispose (GObject *object) { - CajaPropertyBrowserClass *klass; - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (object_klass); + CajaPropertyBrowser *property_browser; + + property_browser = CAJA_PROPERTY_BROWSER (object); + + caja_property_browser_destroy_dialogs (property_browser); + + g_free (property_browser->details->path); + g_free (property_browser->details->category); + g_free (property_browser->details->dragged_file); + g_free (property_browser->details->drag_type); + + eel_g_list_free_deep (property_browser->details->keywords); - klass = CAJA_PROPERTY_BROWSER_CLASS (object_klass); + if (property_browser->details->property_chit) + { + g_object_unref (property_browser->details->property_chit); + } + + G_OBJECT_CLASS (caja_property_browser_parent_class)->dispose (object); +} - object_klass->destroy = caja_property_browser_destroy; +/* initializing the class object by installing the operations we override */ +static void +caja_property_browser_class_init (CajaPropertyBrowserClass *klass) +{ + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + + G_OBJECT_CLASS (klass)->dispose = caja_property_browser_dispose; widget_class->drag_begin = caja_property_browser_drag_begin; widget_class->drag_data_get = caja_property_browser_drag_data_get; widget_class->drag_end = caja_property_browser_drag_end; + + g_type_class_add_private (klass, sizeof (CajaPropertyBrowserDetails)); } /* initialize the instance's fields, create the necessary subviews, etc. */ static void -caja_property_browser_init (GtkObject *object) +caja_property_browser_init (CajaPropertyBrowser *property_browser) { - CajaPropertyBrowser *property_browser; GtkWidget *widget, *temp_box, *temp_hbox, *temp_frame, *vbox; GtkWidget *temp_button; GtkWidget *viewport; PangoAttrList *attrs; char *temp_str; - property_browser = CAJA_PROPERTY_BROWSER (object); - widget = GTK_WIDGET (object); + widget = GTK_WIDGET (property_browser); - property_browser->details = g_new0 (CajaPropertyBrowserDetails, 1); + property_browser->details = G_TYPE_INSTANCE_GET_PRIVATE (property_browser, + CAJA_TYPE_PROPERTY_BROWSER, + CajaPropertyBrowserDetails); property_browser->details->category = g_strdup ("patterns"); property_browser->details->category_type = CAJA_PROPERTY_PATTERN; @@ -405,55 +443,6 @@ caja_property_browser_init (GtkObject *object) caja_property_browser_set_path(property_browser, BROWSER_CATEGORIES_FILE_NAME); } -/* Destroy the three dialogs for adding patterns/colors/emblems if any of them - exist. */ -static void -caja_property_browser_destroy_dialogs (CajaPropertyBrowser *property_browser) -{ - if (property_browser->details->patterns_dialog) - { - gtk_widget_destroy (property_browser->details->patterns_dialog); - property_browser->details->patterns_dialog = NULL; - } - if (property_browser->details->colors_dialog) - { - gtk_widget_destroy (property_browser->details->colors_dialog); - property_browser->details->colors_dialog = NULL; - } - if (property_browser->details->emblems_dialog) - { - gtk_widget_destroy (property_browser->details->emblems_dialog); - property_browser->details->emblems_dialog = NULL; - } -} - -static void -caja_property_browser_destroy (GtkObject *object) -{ - CajaPropertyBrowser *property_browser; - - - property_browser = CAJA_PROPERTY_BROWSER (object); - - caja_property_browser_destroy_dialogs (property_browser); - - g_free (property_browser->details->path); - g_free (property_browser->details->category); - g_free (property_browser->details->dragged_file); - g_free (property_browser->details->drag_type); - - eel_g_list_free_deep (property_browser->details->keywords); - - if (property_browser->details->property_chit) - { - g_object_unref (property_browser->details->property_chit); - } - - g_free (property_browser->details); - - EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object)); -} - /* create a new instance */ CajaPropertyBrowser * caja_property_browser_new (GdkScreen *screen) @@ -555,7 +544,7 @@ caja_property_browser_drag_begin (GtkWidget *widget, /* it's not a color, so, for now, it must be an image */ /* fiddle with the category to handle the "reset" case properly */ char * save_category = property_browser->details->category; - if (eel_strcmp (property_browser->details->category, "colors") == 0) + if (g_strcmp0 (property_browser->details->category, "colors") == 0) { property_browser->details->category = "patterns"; } @@ -625,7 +614,7 @@ caja_property_browser_drag_data_get (GtkWidget *widget, guint16 colorArray[4]; /* handle the "reset" case as an image */ - if (eel_strcmp (property_browser->details->dragged_file, RESET_IMAGE_NAME) != 0) + if (g_strcmp0 (property_browser->details->dragged_file, RESET_IMAGE_NAME) != 0) { gdk_color_parse (property_browser->details->dragged_file, &color); @@ -783,7 +772,7 @@ make_drag_image (CajaPropertyBrowser *property_browser, const char* file_name) return NULL; } - is_reset = eel_strcmp (file_name, RESET_IMAGE_NAME) == 0; + is_reset = g_strcmp0 (file_name, RESET_IMAGE_NAME) == 0; if (strcmp (property_browser->details->category, "patterns") == 0 && property_browser->details->property_chit != NULL) @@ -1240,7 +1229,7 @@ add_pattern_to_browser (GtkDialog *dialog, gint response_id, gpointer *data) /* don't allow the user to change the reset image */ basename = g_file_get_basename (selected); - if (basename && eel_strcmp (basename, RESET_IMAGE_NAME) == 0) + if (basename && g_strcmp0 (basename, RESET_IMAGE_NAME) == 0) { eel_show_error_dialog (_("Sorry, but you cannot replace the reset image."), _("Reset is a special image that cannot be deleted."), @@ -1725,7 +1714,7 @@ element_clicked_callback (GtkWidget *image_table, drag_types[0].target = property_browser->details->drag_type; /* treat the reset property in the colors section specially */ - if (eel_strcmp (element_name, RESET_IMAGE_NAME) == 0) + if (g_strcmp0 (element_name, RESET_IMAGE_NAME) == 0) { drag_types[0].target = "x-special/mate-reset-background"; } @@ -1888,7 +1877,7 @@ make_properties_from_directories (CajaPropertyBrowser *property_browser) /* Keep track of ERASE objects to place them prominently later */ if (property_browser->details->category_type == CAJA_PROPERTY_PATTERN - && !eel_strcmp (object_name, RESET_IMAGE_NAME)) + && !g_strcmp0 (object_name, RESET_IMAGE_NAME)) { g_assert (reset_object == NULL); reset_object = property_image; @@ -2408,7 +2397,7 @@ caja_property_browser_set_category (CajaPropertyBrowser *property_browser, const char *new_category) { /* there's nothing to do if the category is the same as the current one */ - if (eel_strcmp (property_browser->details->category, new_category) == 0) + if (g_strcmp0 (property_browser->details->category, new_category) == 0) { return; } @@ -2417,15 +2406,15 @@ caja_property_browser_set_category (CajaPropertyBrowser *property_browser, property_browser->details->category = g_strdup (new_category); /* set up the property type enum */ - if (eel_strcmp (new_category, "patterns") == 0) + if (g_strcmp0 (new_category, "patterns") == 0) { property_browser->details->category_type = CAJA_PROPERTY_PATTERN; } - else if (eel_strcmp (new_category, "colors") == 0) + else if (g_strcmp0 (new_category, "colors") == 0) { property_browser->details->category_type = CAJA_PROPERTY_COLOR; } - else if (eel_strcmp (new_category, "emblems") == 0) + else if (g_strcmp0 (new_category, "emblems") == 0) { property_browser->details->category_type = CAJA_PROPERTY_EMBLEM; } @@ -2447,7 +2436,7 @@ caja_property_browser_set_path (CajaPropertyBrowser *property_browser, const char *new_path) { /* there's nothing to do if the uri is the same as the current one */ - if (eel_strcmp (property_browser->details->path, new_path) == 0) + if (g_strcmp0 (property_browser->details->path, new_path) == 0) { return; } -- cgit v1.2.1 From 7a42b9b076d6b831c89bd0b9e996368c1c95aef3 Mon Sep 17 00:00:00 2001 From: Jasmine Hassan Date: Thu, 18 Oct 2012 10:30:31 +0200 Subject: [all] use g_list_free() and g_strcmp0 instead of eel functions Was: general: use g_list_free_full() instead of eel functions http://git.gnome.org/browse/nautilus/commit/?id=5e669515fd7f760382e6b7aa1449734a35a2d7f4 . Instead of g_list_free_full(), we use g_list_foreach and g_list_free() to avoid unnecessary glib dependency bump to 2.28 --- src/caja-property-browser.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/caja-property-browser.c') diff --git a/src/caja-property-browser.c b/src/caja-property-browser.c index 5fb5c249..e3ee8dd7 100644 --- a/src/caja-property-browser.c +++ b/src/caja-property-browser.c @@ -34,7 +34,6 @@ #include #include -#include #include #include #include @@ -233,7 +232,8 @@ caja_property_browser_dispose (GObject *object) g_free (property_browser->details->dragged_file); g_free (property_browser->details->drag_type); - eel_g_list_free_deep (property_browser->details->keywords); + g_list_foreach (property_browser->details->keywords, (GFunc) g_free, NULL); + g_list_free(property_browser->details->keywords); if (property_browser->details->property_chit) { @@ -1796,7 +1796,8 @@ make_properties_from_directories (CajaPropertyBrowser *property_browser) if (property_browser->details->category_type == CAJA_PROPERTY_EMBLEM) { - eel_g_list_free_deep (property_browser->details->keywords); + g_list_foreach(property_browser->details->keywords, (GFunc) g_free, NULL); + g_list_free(property_browser->details->keywords); property_browser->details->keywords = NULL; icons = caja_emblem_list_available (); @@ -1850,7 +1851,8 @@ make_properties_from_directories (CajaPropertyBrowser *property_browser) g_object_unref (object_pixbuf); } } - eel_g_list_free_deep (icons); + g_list_foreach(icons, (GFunc) g_free, NULL); + g_list_free(icons); } else { -- cgit v1.2.1