From 0321e0c109de8225a82868cb1dc8cfb5455a544f Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Tue, 19 Apr 2005 11:14:42 +0000 Subject: More constification. 2005-04-19 Christian Persch * lib/egg/egg-editable-toolbar.c: (create_dock): * lib/egg/egg-toolbar-editor.c: (editor_create_item), (update_editor_sheet): * lib/ephy-file-helpers.c: (ephy_file): * lib/widgets/ephy-location-entry.c: (ephy_location_entry_construct_contents): * lib/widgets/ephy-node-view.c: (ephy_node_view_enable_drag_dest), (ephy_node_view_enable_drag_source): * lib/widgets/ephy-node-view.h: * src/ephy-encoding-menu.c: (ephy_encoding_menu_set_window): * src/ephy-history-window.c: (ephy_history_window_construct): * src/ephy-main.c: * src/ephy-notebook.c: (ephy_notebook_init), (ephy_notebook_add_tab): * src/ppview-toolbar.c: * src/window-commands.c: (window_cmd_help_about): More constification. --- ChangeLog | 21 +++++++++++++++++++++ lib/egg/egg-editable-toolbar.c | 5 ++--- lib/egg/egg-toolbar-editor.c | 10 ++++------ lib/ephy-file-helpers.c | 8 ++++---- lib/widgets/ephy-location-entry.c | 5 ++--- lib/widgets/ephy-node-view.c | 4 ++-- lib/widgets/ephy-node-view.h | 4 ++-- src/ephy-encoding-menu.c | 10 ++++------ src/ephy-history-window.c | 17 +++++++---------- src/ephy-main.c | 6 +++--- src/ephy-notebook.c | 7 +++---- src/ppview-toolbar.c | 16 ++++++++-------- src/window-commands.c | 5 ++--- 13 files changed, 64 insertions(+), 54 deletions(-) diff --git a/ChangeLog b/ChangeLog index d6d519a52..60fc692ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2005-04-19 Christian Persch + + * lib/egg/egg-editable-toolbar.c: (create_dock): + * lib/egg/egg-toolbar-editor.c: (editor_create_item), + (update_editor_sheet): + * lib/ephy-file-helpers.c: (ephy_file): + * lib/widgets/ephy-location-entry.c: + (ephy_location_entry_construct_contents): + * lib/widgets/ephy-node-view.c: (ephy_node_view_enable_drag_dest), + (ephy_node_view_enable_drag_source): + * lib/widgets/ephy-node-view.h: + * src/ephy-encoding-menu.c: (ephy_encoding_menu_set_window): + * src/ephy-history-window.c: (ephy_history_window_construct): + * src/ephy-main.c: + * src/ephy-notebook.c: (ephy_notebook_init), + (ephy_notebook_add_tab): + * src/ppview-toolbar.c: + * src/window-commands.c: (window_cmd_help_about): + + More constification. + 2005-04-19 Christian Persch * configure.ac: diff --git a/lib/egg/egg-editable-toolbar.c b/lib/egg/egg-editable-toolbar.c index aeaccbdbf..210cebe8c 100755 --- a/lib/egg/egg-editable-toolbar.c +++ b/lib/egg/egg-editable-toolbar.c @@ -47,10 +47,9 @@ static void egg_editable_toolbar_finalize (GObject *object); #define MIN_TOOLBAR_HEIGHT 20 -static GtkTargetEntry dest_drag_types[] = { +static const GtkTargetEntry dest_drag_types[] = { {EGG_TOOLBAR_ITEM_TYPE, GTK_TARGET_SAME_APP, 0}, }; -static int n_dest_drag_types = G_N_ELEMENTS (dest_drag_types); enum { @@ -700,7 +699,7 @@ create_dock (EggEditableToolbar *t) gtk_box_pack_start (GTK_BOX (hbox), toolbar, TRUE, TRUE, 0); gtk_drag_dest_set (toolbar, 0, - dest_drag_types, n_dest_drag_types, + dest_drag_types, G_N_ELEMENTS (dest_drag_types), GDK_ACTION_MOVE | GDK_ACTION_COPY); g_signal_connect (toolbar, "drag_drop", diff --git a/lib/egg/egg-toolbar-editor.c b/lib/egg/egg-toolbar-editor.c index f17dd41a5..185703819 100755 --- a/lib/egg/egg-toolbar-editor.c +++ b/lib/egg/egg-toolbar-editor.c @@ -35,15 +35,13 @@ #include #include -static GtkTargetEntry dest_drag_types[] = { +static const GtkTargetEntry dest_drag_types[] = { {EGG_TOOLBAR_ITEM_TYPE, GTK_TARGET_SAME_APP, 0}, }; -static int n_dest_drag_types = G_N_ELEMENTS (dest_drag_types); -static GtkTargetEntry source_drag_types[] = { +static const GtkTargetEntry source_drag_types[] = { {EGG_TOOLBAR_ITEM_TYPE, GTK_TARGET_SAME_APP, 0}, }; -static int n_source_drag_types = G_N_ELEMENTS (source_drag_types); static void egg_toolbar_editor_class_init (EggToolbarEditorClass *klass); static void egg_toolbar_editor_init (EggToolbarEditor *t); @@ -452,7 +450,7 @@ editor_create_item (EggToolbarEditor *editor, gtk_widget_show (event_box); gtk_drag_source_set (event_box, GDK_BUTTON1_MASK, - source_drag_types, n_source_drag_types, action); + source_drag_types, G_N_ELEMENTS (source_drag_types), action); g_signal_connect (event_box, "drag_data_get", G_CALLBACK (drag_data_get_cb), editor); g_signal_connect (event_box, "drag_data_delete", @@ -509,7 +507,7 @@ update_editor_sheet (EggToolbarEditor *editor) gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (editor->priv->scrolled_window), table); gtk_drag_dest_set (table, GTK_DEST_DEFAULT_ALL, - dest_drag_types, n_dest_drag_types, GDK_ACTION_MOVE); + dest_drag_types, G_N_ELEMENTS (dest_drag_types), GDK_ACTION_MOVE); g_signal_connect (table, "drag_data_received", G_CALLBACK (editor_drag_data_received_cb), editor); diff --git a/lib/ephy-file-helpers.c b/lib/ephy-file-helpers.c index 955df8a68..8f06eba69 100644 --- a/lib/ephy-file-helpers.c +++ b/lib/ephy-file-helpers.c @@ -165,9 +165,9 @@ const char * ephy_file (const char *filename) { char *ret; - int i; + guint i; - static char *paths[] = + static const char * const paths[] = { SHARE_DIR "/", SHARE_DIR "/glade/", @@ -183,7 +183,7 @@ ephy_file (const char *filename) if (ret != NULL) return ret; - for (i = 0; i < (int) G_N_ELEMENTS (paths); i++) + for (i = 0; i < G_N_ELEMENTS (paths); i++) { ret = g_strconcat (paths[i], filename, NULL); if (g_file_test (ret, G_FILE_TEST_EXISTS) == TRUE) @@ -194,7 +194,7 @@ ephy_file (const char *filename) g_free (ret); } - g_warning (_("Failed to find %s"), filename); + g_warning ("Failed to find %s\n", filename); return NULL; } diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c index 426c874b9..63ca5cb38 100644 --- a/lib/widgets/ephy-location-entry.c +++ b/lib/widgets/ephy-location-entry.c @@ -87,13 +87,12 @@ web_prefixes [] = { "www.", 4 } }; -static GtkTargetEntry url_drag_types [] = +static const GtkTargetEntry url_drag_types [] = { { EPHY_DND_URL_TYPE, 0, 0 }, { EPHY_DND_URI_LIST_TYPE, 0, 1 }, { EPHY_DND_TEXT_TYPE, 0, 2 } }; -static int n_url_drag_types = G_N_ELEMENTS (url_drag_types); static void ephy_location_entry_class_init (EphyLocationEntryClass *klass); static void ephy_location_entry_init (EphyLocationEntry *le); @@ -568,7 +567,7 @@ ephy_location_entry_construct_contents (EphyLocationEntry *entry) gtk_event_box_set_visible_window (GTK_EVENT_BOX (priv->icon_ebox), FALSE); gtk_box_pack_start (GTK_BOX (hbox), priv->icon_ebox, FALSE, FALSE, 2); gtk_drag_source_set (priv->icon_ebox, GDK_BUTTON1_MASK, - url_drag_types, n_url_drag_types, + url_drag_types, G_N_ELEMENTS (url_drag_types), GDK_ACTION_ASK | GDK_ACTION_COPY | GDK_ACTION_LINK); gtk_tooltips_set_tip (priv->tips, priv->icon_ebox, _("Drag and drop this icon to create a link to this page"), NULL); diff --git a/lib/widgets/ephy-node-view.c b/lib/widgets/ephy-node-view.c index a0d229d64..668ac4ba6 100644 --- a/lib/widgets/ephy-node-view.c +++ b/lib/widgets/ephy-node-view.c @@ -443,7 +443,7 @@ drag_drop_cb (GtkWidget *widget, void ephy_node_view_enable_drag_dest (EphyNodeView *view, - GtkTargetEntry *types, + const GtkTargetEntry *types, int n_types) { GtkWidget *treeview; @@ -1402,7 +1402,7 @@ ephy_node_view_select_node (EphyNodeView *view, void ephy_node_view_enable_drag_source (EphyNodeView *view, - GtkTargetEntry *types, + const GtkTargetEntry *types, int n_types, int base_drag_column, int extra_drag_column) diff --git a/lib/widgets/ephy-node-view.h b/lib/widgets/ephy-node-view.h index dab2f6da8..bd8ff1fb1 100644 --- a/lib/widgets/ephy-node-view.h +++ b/lib/widgets/ephy-node-view.h @@ -112,13 +112,13 @@ void ephy_node_view_select_node (EphyNodeView *view, EphyNode *node); void ephy_node_view_enable_drag_source (EphyNodeView *view, - GtkTargetEntry *types, + const GtkTargetEntry *types, int n_types, int base_drag_column_id, int extra_drag_column_id); void ephy_node_view_enable_drag_dest (EphyNodeView *view, - GtkTargetEntry *types, + const GtkTargetEntry *types, int n_types); void ephy_node_view_edit (EphyNodeView *view, diff --git a/src/ephy-encoding-menu.c b/src/ephy-encoding-menu.c index 37ddd6337..a687d0421 100644 --- a/src/ephy-encoding-menu.c +++ b/src/ephy-encoding-menu.c @@ -345,21 +345,19 @@ ephy_encoding_menu_automatic_cb (GtkAction *action, EphyEncodingMenu *menu) ephy_embed_set_encoding (embed, ""); } -static GtkActionEntry menu_entries [] = +static const GtkActionEntry menu_entries [] = { { "ViewEncodingOther", NULL, N_("_Other..."), NULL, N_("Other encodings"), G_CALLBACK (ephy_encoding_menu_view_dialog_cb) } }; -static guint n_menu_entries = G_N_ELEMENTS (menu_entries); -static GtkToggleActionEntry toggle_menu_entries [] = +static const GtkToggleActionEntry toggle_menu_entries [] = { { "ViewEncodingAutomatic", NULL, N_("_Automatic"), NULL, N_("Use the encoding specified by the document"), G_CALLBACK (ephy_encoding_menu_automatic_cb), FALSE } }; -static const guint n_toggle_menu_entries = G_N_ELEMENTS (toggle_menu_entries); static void ephy_encoding_menu_set_window (EphyEncodingMenu *menu, EphyWindow *window) @@ -380,9 +378,9 @@ ephy_encoding_menu_set_window (EphyEncodingMenu *menu, EphyWindow *window) menu->priv->action_group = action_group; gtk_action_group_add_actions (action_group, menu_entries, - n_menu_entries, menu); + G_N_ELEMENTS (menu_entries), menu); gtk_action_group_add_toggle_actions (action_group, toggle_menu_entries, - n_toggle_menu_entries, menu); + G_N_ELEMENTS (toggle_menu_entries), menu); /* add actions for the existing encodings */ encodings = ephy_encodings_get_all (menu->priv->encodings); diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c index e499a19f8..0fe345ad1 100644 --- a/src/ephy-history-window.c +++ b/src/ephy-history-window.c @@ -68,13 +68,12 @@ #include "ephy-node-common.h" #include "ephy-node-view.h" -static GtkTargetEntry page_drag_types [] = +static const GtkTargetEntry page_drag_types [] = { { EPHY_DND_URL_TYPE, 0, 0 }, { EPHY_DND_URI_LIST_TYPE, 0, 1 }, { EPHY_DND_TEXT_TYPE, 0, 2 } }; -static int n_page_drag_types = G_N_ELEMENTS (page_drag_types); static void ephy_history_window_class_init (EphyHistoryWindowClass *klass); static void ephy_history_window_init (EphyHistoryWindow *editor); @@ -159,7 +158,7 @@ enum static GObjectClass *parent_class = NULL; -static GtkActionEntry ephy_history_ui_entries [] = { +static const GtkActionEntry ephy_history_ui_entries [] = { /* Toplevel */ { "File", NULL, N_("_File") }, { "Edit", NULL, N_("_Edit") }, @@ -209,7 +208,6 @@ static GtkActionEntry ephy_history_ui_entries [] = { N_("Display credits for the web browser creators"), G_CALLBACK (window_cmd_help_about) }, }; -static guint ephy_history_ui_n_entries = G_N_ELEMENTS (ephy_history_ui_entries); enum { @@ -218,7 +216,7 @@ enum VIEW_TITLE_AND_ADDRESS }; -static GtkRadioActionEntry ephy_history_radio_entries [] = +static const GtkRadioActionEntry ephy_history_radio_entries [] = { /* View Menu */ { "ViewTitle", NULL, N_("_Title"), NULL, @@ -229,7 +227,6 @@ static GtkRadioActionEntry ephy_history_radio_entries [] = N_("Show both the title and address columns"), VIEW_TITLE_AND_ADDRESS } }; -static guint ephy_history_n_radio_entries = G_N_ELEMENTS (ephy_history_radio_entries); static void confirmation_dialog_response_cb (GtkWidget *dialog, @@ -1208,12 +1205,12 @@ ephy_history_window_construct (EphyHistoryWindow *editor) action_group = gtk_action_group_new ("PopupActions"); gtk_action_group_set_translation_domain (action_group, NULL); gtk_action_group_add_actions (action_group, ephy_history_ui_entries, - ephy_history_ui_n_entries, editor); + G_N_ELEMENTS (ephy_history_ui_entries), editor); details_value = get_details_value (); gtk_action_group_add_radio_actions (action_group, ephy_history_radio_entries, - ephy_history_n_radio_entries, + G_N_ELEMENTS (ephy_history_radio_entries), details_value, G_CALLBACK (cmd_view_columns), editor); @@ -1262,7 +1259,7 @@ ephy_history_window_construct (EphyHistoryWindow *editor) NULL); ephy_node_view_enable_drag_source (EPHY_NODE_VIEW (sites_view), page_drag_types, - n_page_drag_types, + G_N_ELEMENTS (page_drag_types), url_col_id, title_col_id); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (sites_view)); @@ -1329,7 +1326,7 @@ ephy_history_window_construct (EphyHistoryWindow *editor) editor->priv->address_col = col; ephy_node_view_enable_drag_source (EPHY_NODE_VIEW (pages_view), page_drag_types, - n_page_drag_types, + G_N_ELEMENTS (page_drag_types), url_col_id, title_col_id); ephy_node_view_set_sort (EPHY_NODE_VIEW (pages_view), G_TYPE_INT, EPHY_NODE_PAGE_PROP_LAST_VISIT, diff --git a/src/ephy-main.c b/src/ephy-main.c index 71b542a1a..052ef3979 100644 --- a/src/ephy-main.c +++ b/src/ephy-main.c @@ -47,9 +47,9 @@ static gboolean open_in_new_tab = FALSE; static gboolean open_fullscreen = FALSE; static gboolean open_as_bookmarks_editor = FALSE; -static const char *session_filename = NULL; -static const char *bookmark_url = NULL; -static const char *bookmarks_file = NULL; +static char *session_filename = NULL; +static char *bookmark_url = NULL; +static char *bookmarks_file = NULL; static struct poptOption popt_options[] = { diff --git a/src/ephy-notebook.c b/src/ephy-notebook.c index 8ba8c29ba..182849ce6 100644 --- a/src/ephy-notebook.c +++ b/src/ephy-notebook.c @@ -86,12 +86,11 @@ static void move_tab_to_another_notebook (EphyNotebook *src, /* Local variables */ static GdkCursor *cursor = NULL; -static GtkTargetEntry url_drag_types [] = +static const GtkTargetEntry url_drag_types [] = { { EPHY_DND_URI_LIST_TYPE, 0, 0 }, { EPHY_DND_URL_TYPE, 0, 1 } }; -static guint n_url_drag_types = G_N_ELEMENTS (url_drag_types); enum { @@ -808,7 +807,7 @@ ephy_notebook_init (EphyNotebook *notebook) NULL); gtk_drag_dest_set (GTK_WIDGET(notebook), GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP, - url_drag_types,n_url_drag_types, + url_drag_types, G_N_ELEMENTS (url_drag_types), GDK_ACTION_MOVE | GDK_ACTION_COPY); notebook->priv->tabs_vis_notifier_id = eel_gconf_notification_add @@ -1049,7 +1048,7 @@ ephy_notebook_add_tab (EphyNotebook *nb, g_signal_connect (G_OBJECT(label), "drag_data_received", G_CALLBACK(notebook_drag_data_received_cb), tab); gtk_drag_dest_set (label, GTK_DEST_DEFAULT_ALL, - url_drag_types,n_url_drag_types, + url_drag_types, G_N_ELEMENTS (url_drag_types), GDK_ACTION_MOVE | GDK_ACTION_COPY); sync_icon (tab, NULL, label); diff --git a/src/ppview-toolbar.c b/src/ppview-toolbar.c index d2749094d..6c5be3937 100755 --- a/src/ppview-toolbar.c +++ b/src/ppview-toolbar.c @@ -84,7 +84,7 @@ static void toolbar_cmd_ppv_close (GtkUIManager *merge, PPViewToolbar *t); -static GtkActionEntry entries [] = { +static const GtkActionEntry entries [] = { { "PPVGotoFirst", GTK_STOCK_GOTO_FIRST, N_("First"), NULL, N_("Go to the first page"), @@ -109,13 +109,13 @@ static GtkActionEntry entries [] = { static const char ui_info[] = "" -" " -" " -" " -" " -" " -" " -" \n" +"" +"" +"" +"" +"" +"" +"" "\n"; GType diff --git a/src/window-commands.c b/src/window-commands.c index 2b06e2ca5..f6f59b1ee 100644 --- a/src/window-commands.c +++ b/src/window-commands.c @@ -753,15 +753,14 @@ void window_cmd_help_about (GtkAction *action, GtkWidget *window) { - static char *authors[] = { + static const char * const authors[] = { "Marco Pesenti Gritti ", "Xan Lopez ", "David Bordoley ", "Christian Persch ", NULL }; - - static char *documenters[] = { + static const char *const documenters[] = { "Patanjali Somayaji ", "David Bordoley ", "Piers Cornwell ", -- cgit v1.2.3