After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 429422 - Massive code cleanup
Massive code cleanup
Status: RESOLVED FIXED
Product: evolution
Classification: Applications
Component: general
2.10.x (obsolete)
Other Linux
: Normal normal
: ---
Assigned To: Matthew Barnes
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2007-04-13 16:56 UTC by Matthew Barnes
Modified: 2007-07-27 21:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (237.69 KB, patch)
2007-04-13 16:59 UTC, Matthew Barnes
committed Details | Review
A patch for widgets/text. (5.07 KB, patch)
2007-07-19 05:05 UTC, Hiroyuki Ikezoe
none Details | Review
revised patch (13.90 KB, patch)
2007-07-19 05:28 UTC, Hiroyuki Ikezoe
none Details | Review
A patch for widgets/misc (16.96 KB, patch)
2007-07-19 06:11 UTC, Hiroyuki Ikezoe
none Details | Review
unified patch for widgets directory except widgets/table (46.90 KB, patch)
2007-07-19 13:21 UTC, Hiroyuki Ikezoe
committed Details | Review
A patch for widgets/table (102.40 KB, patch)
2007-07-20 03:32 UTC, Hiroyuki Ikezoe
none Details | Review
A patch for e-util. (7.33 KB, patch)
2007-07-20 03:33 UTC, Hiroyuki Ikezoe
committed Details | Review
revised patch for widgets/table. (102.40 KB, patch)
2007-07-20 06:53 UTC, Hiroyuki Ikezoe
committed Details | Review

Description Matthew Barnes 2007-04-13 16:56:12 UTC
More cleanup work for Evolution.  This patch makes significant progress
towards migrating off deprecated symbols in the GTK+ and GNOME libraries.
I'm also killing off several utility functions and macros that have become
redundant or unused over the years.

Here's the checklist:

- Fix all implicit function declarations.

- Port evolution-addressbook-export from popt to GOption.

- Drop GnomePropertyBox support in e-dialog-widgets.c (no longer needed).

- Migrate to non-deprecated symbols:

    GNOME_STOCK_xxx                      --> GTK_STOCK_xxx
    GTK_OBJECT_FLOATING()                --> g_object_is_floating()
    GTK_OBJECT_SET_FLAGS()               --> g_object_force_floating()
    GnomeDialog                          --> GtkDialog
    GnomeFileEntry                       --> GtkFileChooserButton
    GnomeIconTheme                       --> GtkIconTheme
    GnomeMessageBox                      --> GtkMessageDialog
    g_concat_dir_and_file()              --> g_build_filename()
    g_object_ref(), gtk_object_sink()    --> g_object_ref_sink()
    gnome_date_edit_get_date()           --> gnome_date_edit_get_time()
    gnome_init()                         --> gnome_program_init()
    gnome_window_set_icon_from_file()    --> gtk_window_set_icon_from_file()
    gtk_accel_group_unref()              --> g_object_unref()
    gtk_button_box_set_child_ipadding()  --> (nothing, use style properties)
    gtk_button_box_set_child_size()      --> (nothing, use style properties)
    gtk_button_box_set_spacing()         --> gtk_box_set_spacing()
    gtk_cell_renderer_editing_canceled() --> gtk_cell_renderer_stop_editing()
    gtk_draw_shadow()                    --> gtk_paint_shadow()
    gtk_entry_set_editable()             --> gtk_editable_set_editable()
    gtk_idle_add()                       --> g_idle_add()
    gtk_idle_remove()                    --> g_source_remove()
    gtk_label_get()                      --> gtk_label_get_text()
    gtk_layout_freeze()                  --> (nothing)
    gtk_layout_thaw()                    --> (nothing)
    gtk_marshal_NONE__INT                --> g_cclosure_marshal_VOID__INT
    gtk_menu_append()                    --> gtk_menu_shell_append()
    gtk_notebook_set_page()              --> gtk_notebook_set_current_page()
    gtk_radio_menu_item_group()          --> gtk_radio_menu_item_get_group()
    gtk_signal_connect_object()          --> g_signal_connect_swapped()
    gtk_timeout_add()                    --> g_timeout_add()
    gtk_timeout_remove()                 --> g_source_remove()
    gtk_type_new()                       --> g_object_new()
    gtk_widget_draw()                    --> (use GTK's implementation)
    gtk_widget_ref()                     --> g_object_ref()
    gtk_widget_set_usize()               --> gtk_widget_set_size_request()
    gtk_widget_unref()                   --> g_object_unref()

- Remove some unused utilities and macros:

    E_MAKE_X_TYPE
    E_OBJECT_CLASS_ADD_SIGNALS
    GET_DUPLICATED_STRING_ARRAY_FROM_ELLIPSIS
    GET_STRING_ARRAY_FROM_ELLIPSIS
    e_create_image_widget()
    e_make_widget_backing_stored()
    e_read_file()
    e_signal_connect_full_while_alive()
    e_signal_connect_while_alive()
    e_strsplit()
    e_write_file()
    e_writh_file_mkstemp()

- Remove some obsolete or unnecessary utilities:

    - E_OBJECT_CLASS_TYPE

        Replace with G_TYPE_FROM_CLASS.

    - e_strdup_strip()

        Replace with g_strstrip (g_strdup (str)).

    - e_free_object_list() / e_free_object_slist()

        Replace with:

          g_list_foreach (list, (GFunc) g_object_unref, NULL);
          g_list_free (list);

        Similarly for e_free_object_slist().

    - e_free_string_list() / e_free_string_slist()

        Replace with:

          g_list_foreach (list, (GFunc) g_free, NULL);
          g_list_free (list);

        Similarly for e_free_string_slist().

    - e_sort()

        Replace with g_qsort_with_data ().

    - e_button_new_with_stock_icon() / e_gtk_button_new_with_icon()

        Replace with gtk_button_new_from_stock(), or:

          button = gtk_button_new_with_mnemonic (label);
          image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON);
          gtk_button_set_image (button, image);

    - e_create_directory() / e_util_mkdir_hier()

        Replace with g_mkdir_with_parents().


A side-effect of this cleanup effort is that I was able to pin down the
remaining deprecated widgets and functions that Evolution is still using.
Migrating away from them will be more involved than the cases addressed by
this bug, so I plan on dealing with each of them on a case-by-case basis.

Here's a list of the major deprecated items that Evolution is still using:

    gnome-config                (migrate to GKeyFile)
    GnomeDialog                 (migrate to GtkDialog)
    GnomeDruid                  (migrate to GtkAssistant)
    GnomeIconList               (migrate to GtkIconView)
    GtkCombo                    (migrate to GtkComboBoxEntry)
    GtkOptionMenu               (migrate to GtkComboBox)
    The old GTK+ object system  (migrate to libgobject)
Comment 1 Matthew Barnes 2007-04-13 16:59:11 UTC
Created attachment 86302 [details] [review]
Proposed patch

Sorry to keep submitting these massive patches for review...
Comment 2 Matthew Barnes 2007-04-13 17:26:05 UTC
I strongly recommend using a graphical diff viewer like Meld [1] to review these changes.  Apply the patch to a clean Subversion checkout and use Meld's version control browser.

[1] http://meld.sourceforge.net/
Comment 3 Srinivasa Ragavan 2007-04-18 15:35:39 UTC
Matthew, most of the patch looks fine to me. Except a few.

1. I wasnt very clear of the changes you have done in hook_WIDGETS  function of e-dialog-utils (?) .

2. I noticed that gnome_warning_dialog/other types weren't marked with respective GTK_MESSAGE_ at a few places. It is fine in other places.

Apart from these two, the patch look fine to me.

/me wants matthew to attach with smaller patches rather than MASSIVE ones like this :)

Anyways, great job Matthew :)
Comment 4 Matthew Barnes 2007-04-18 16:25:03 UTC
(In reply to comment #3)
> 1. I wasnt very clear of the changes you have done in hook_WIDGETS  function of
> e-dialog-utils (?) .

I was dropping support for GnomePropertyBox, which is deprecated in libgnomeui and is not (or no longer) used anywhere else in Evolution or Evolution-Exchange.


> 2. I noticed that gnome_warning_dialog/other types weren't marked with
> respective GTK_MESSAGE_ at a few places. It is fine in other places.

Some cases will be eliminated by my print cleanup patch (bug #426816), so I purposely skipped them here.  I'll pick off any remaining cases after the dust from these two massive patches settles.


> /me wants matthew to attach with smaller patches rather than MASSIVE ones like
> this :)

Yeah, sorry about that.  I'll try to break them into more managable pieces in the future.  You're a trouper for reviewing them.  I appreciate it.  :)

Comment 5 Srinivasa Ragavan 2007-04-19 12:49:58 UTC
> Some cases will be eliminated by my print cleanup patch (bug #426816), so I
> purposely skipped them here.  I'll pick off any remaining cases after the dust
> from these two massive patches settles.

I go by your words :). Please commit.

Comment 6 Matthew Barnes 2007-04-19 19:09:56 UTC
Committed to Subversion trunk (revision 33432).
Comment 7 Hiroyuki Ikezoe 2007-07-19 04:45:50 UTC
Matthew, I think gtk_signal_xx() functions and E_MAKE_TYPE should be rewritten.
Comment 8 Hiroyuki Ikezoe 2007-07-19 05:05:18 UTC
Created attachment 91958 [details] [review]
A patch for widgets/text.
Comment 9 Hiroyuki Ikezoe 2007-07-19 05:05:42 UTC
Can somebody reopen this bug?
Comment 10 Hiroyuki Ikezoe 2007-07-19 05:28:47 UTC
Created attachment 91959 [details] [review]
revised patch

Sorry, my previous patch does not remove g_type_class_ref().
Comment 11 Hiroyuki Ikezoe 2007-07-19 06:11:29 UTC
Created attachment 91960 [details] [review]
A patch for widgets/misc
Comment 12 Hiroyuki Ikezoe 2007-07-19 13:21:40 UTC
Created attachment 91982 [details] [review]
unified patch for widgets directory except widgets/table

I will post another patch for widgets/table directory because the directory has its own ChangeLog file.
Comment 13 Hiroyuki Ikezoe 2007-07-20 03:32:48 UTC
Created attachment 92017 [details] [review]
A patch for widgets/table
Comment 14 Hiroyuki Ikezoe 2007-07-20 03:33:35 UTC
Created attachment 92018 [details] [review]
A patch for e-util.
Comment 15 Hiroyuki Ikezoe 2007-07-20 03:34:09 UTC
E_MAKE_TYPE has now eliminated.
Comment 16 Hiroyuki Ikezoe 2007-07-20 06:53:54 UTC
Created attachment 92024 [details] [review]
revised patch for widgets/table.

Sorry, the previous patch has a horrible typo.

 E_SELECTION_MODEL_TYPE -> E_SELECTION_MODEL_ARRAY_TYPE
Comment 17 Srinivasa Ragavan 2007-07-26 09:09:33 UTC
Matthew, Can you review this for 2.11.6 and push it accordingly?
Comment 18 Matthew Barnes 2007-07-27 21:17:09 UTC
Looks good, nice cleanup!

Committed to Subversion trunk (revision 33864).