diff options
61 files changed, 787 insertions, 787 deletions
diff --git a/baobab/src/baobab-cell-renderer-progress.c b/baobab/src/baobab-cell-renderer-progress.c index 94b44d88..de3f115a 100644 --- a/baobab/src/baobab-cell-renderer-progress.c +++ b/baobab/src/baobab-cell-renderer-progress.c @@ -31,7 +31,7 @@ enum { PROP_0, PROP_PERC -}; +}; struct _BaobabCellRendererProgressPrivate { @@ -62,7 +62,7 @@ baobab_cell_renderer_progress_get_property (GObject *object, GParamSpec *pspec) { BaobabCellRendererProgress *cellprogress = BAOBAB_CELL_RENDERER_PROGRESS (object); - + switch (param_id) { case PROP_PERC: @@ -202,7 +202,7 @@ baobab_cell_renderer_progress_render (GtkCellRenderer *cell, x = cell_area->x + xpad; y = cell_area->y + ypad; - + w = cell_area->width - xpad * 2; h = cell_area->height - ypad * 2; @@ -222,7 +222,7 @@ baobab_cell_renderer_progress_render (GtkCellRenderer *cell, y += style->ythickness; w -= style->xthickness * 2; h -= style->ythickness * 2; - + cairo_rectangle (cr, x, y, w, h); cairo_set_source_rgb (cr, 1, 1, 1); cairo_fill (cr); @@ -239,10 +239,10 @@ baobab_cell_renderer_progress_class_init (BaobabCellRendererProgressClass *klass { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (klass); - + object_class->get_property = baobab_cell_renderer_progress_get_property; object_class->set_property = baobab_cell_renderer_progress_set_property; - + cell_class->get_size = baobab_cell_renderer_progress_get_size; cell_class->render = baobab_cell_renderer_progress_render; diff --git a/baobab/src/baobab-cell-renderer-progress.h b/baobab/src/baobab-cell-renderer-progress.h index 006a21f9..4fd2ca64 100644 --- a/baobab/src/baobab-cell-renderer-progress.h +++ b/baobab/src/baobab-cell-renderer-progress.h @@ -39,7 +39,7 @@ typedef struct _BaobabCellRendererProgressPrivate BaobabCellRendererProgressPri struct _BaobabCellRendererProgress { GtkCellRenderer parent_instance; - + /*< private >*/ BaobabCellRendererProgressPrivate *priv; }; diff --git a/baobab/src/baobab-prefs.c b/baobab/src/baobab-prefs.c index 41e430dd..f43d3472 100644 --- a/baobab/src/baobab-prefs.c +++ b/baobab/src/baobab-prefs.c @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301 USA */ @@ -110,7 +110,7 @@ filechooser_response_cb (GtkDialog *dialog, { switch (response_id) { case GTK_RESPONSE_HELP: - baobab_help_display (GTK_WINDOW (baobab.window), + baobab_help_display (GTK_WINDOW (baobab.window), "mate-disk-usage-analyzer", "baobab-preferences"); break; case GTK_RESPONSE_DELETE_EVENT: @@ -247,10 +247,10 @@ fill_props_model (GtkListStore *store) glibtop_get_fsusage (&fsusage, mountentry->mountdir); fstotal = fsusage.blocks * fsusage.block_size; fsavail = fsusage.bfree * fsusage.block_size; - + total = g_format_size(fstotal); avail = g_format_size(fsavail); - + file = g_file_new_for_path (mountentry->mountdir); uri = g_file_get_uri (file); excluded = baobab_is_excluded_location (file); diff --git a/baobab/src/baobab-prefs.h b/baobab/src/baobab-prefs.h index 57cbb972..73893ae8 100644 --- a/baobab/src/baobab-prefs.h +++ b/baobab/src/baobab-prefs.h @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301 USA */ diff --git a/baobab/src/baobab-remote-connect-dialog.c b/baobab/src/baobab-remote-connect-dialog.c index 6c901f3d..08d836f6 100644 --- a/baobab/src/baobab-remote-connect-dialog.c +++ b/baobab/src/baobab-remote-connect-dialog.c @@ -38,7 +38,7 @@ /* Translators: all the strings in this file are meant to map the - similar strings inside caja-connect-server and should be + similar strings inside caja-connect-server and should be translated the same way */ @@ -63,7 +63,7 @@ G_DEFINE_TYPE(BaobabRemoteConnectDialog, baobab_remote_connect_dialog, GTK_TYPE_ static void -display_error_dialog (GError *error, +display_error_dialog (GError *error, GFile *location, GtkWindow *parent) { @@ -142,13 +142,13 @@ struct MethodInfo { /* A collection of flags for MethodInfo.flags */ enum { DEFAULT_METHOD = 0x00000001, - + /* Widgets to display in setup_for_type */ SHOW_SHARE = 0x00000010, SHOW_PORT = 0x00000020, SHOW_USER = 0x00000040, SHOW_DOMAIN = 0x00000080, - + IS_ANONYMOUS = 0x00001000 }; @@ -185,7 +185,7 @@ get_method_description (struct MethodInfo *meth) return _("WebDAV (HTTP)"); } else if (strcmp (meth->scheme, "davs") == 0) { return _("Secure WebDAV (HTTPS)"); - + /* No descriptive text */ } else { return meth->scheme; @@ -206,7 +206,7 @@ baobab_remote_connect_dialog_finalize (GObject *object) g_object_unref (dialog->details->folder_entry); g_object_unref (dialog->details->domain_entry); g_object_unref (dialog->details->user_entry); - + g_free (dialog->details); G_OBJECT_CLASS (baobab_remote_connect_dialog_parent_class)->finalize (object); @@ -220,7 +220,7 @@ connect_to_server (BaobabRemoteConnectDialog *dialog, GtkWindow *app) GFile *location; int index; GtkTreeIter iter; - + /* Get our method info */ gtk_combo_box_get_active_iter (GTK_COMBO_BOX (dialog->details->type_combo), &iter); gtk_tree_model_get (gtk_combo_box_get_model (GTK_COMBO_BOX (dialog->details->type_combo)), @@ -255,7 +255,7 @@ connect_to_server (BaobabRemoteConnectDialog *dialog, GtkWindow *app) g_free (server); return; } - + user = ""; port = ""; initial_path = ""; @@ -264,11 +264,11 @@ connect_to_server (BaobabRemoteConnectDialog *dialog, GtkWindow *app) free_user = FALSE; free_domain = FALSE; free_port = FALSE; - + /* FTP special case */ if (meth->flags & IS_ANONYMOUS) { user = "anonymous"; - + /* SMB special case */ } else if (strcmp (meth->scheme, "smb") == 0) { t = gtk_editable_get_chars (GTK_EDITABLE (dialog->details->share_entry), 0, -1); @@ -284,7 +284,7 @@ connect_to_server (BaobabRemoteConnectDialog *dialog, GtkWindow *app) folder = gtk_editable_get_chars (GTK_EDITABLE (dialog->details->folder_entry), 0, -1); if (gtk_widget_get_parent (dialog->details->user_entry) != NULL) { free_user = TRUE; - + t = gtk_editable_get_chars (GTK_EDITABLE (dialog->details->user_entry), 0, -1); user = g_uri_escape_string (t, G_URI_RESERVED_CHARS_ALLOWED_IN_USERINFO, FALSE); @@ -295,7 +295,7 @@ connect_to_server (BaobabRemoteConnectDialog *dialog, GtkWindow *app) free_domain = TRUE; domain = gtk_editable_get_chars (GTK_EDITABLE (dialog->details->domain_entry), 0, -1); - + if (strlen (domain) != 0) { t = user; @@ -397,7 +397,7 @@ setup_for_type (BaobabRemoteConnectDialog *dialog) int index, i; GtkWidget *label, *grid; GtkTreeIter iter; - + /* Get our method info */ gtk_combo_box_get_active_iter (GTK_COMBO_BOX (dialog->details->type_combo), &iter); gtk_tree_model_get (gtk_combo_box_get_model (GTK_COMBO_BOX (dialog->details->type_combo)), @@ -439,7 +439,7 @@ setup_for_type (BaobabRemoteConnectDialog *dialog) i = 1; grid = dialog->details->grid; - + if (meth->scheme == NULL) { label = gtk_label_new_with_mnemonic (_("_Location (URI):")); gtk_label_set_xalign (GTK_LABEL (label), 0.0); @@ -456,7 +456,7 @@ setup_for_type (BaobabRemoteConnectDialog *dialog) return; } - + label = gtk_label_new_with_mnemonic (_("_Server:")); gtk_label_set_xalign (GTK_LABEL (label), 0.0); gtk_label_set_yalign (GTK_LABEL (label), 0.5); @@ -477,7 +477,7 @@ setup_for_type (BaobabRemoteConnectDialog *dialog) gtk_grid_attach (GTK_GRID (grid), label, 0, i, 2, 1); i++; - + if (meth->flags & SHOW_SHARE) { label = gtk_label_new_with_mnemonic (_("_Share:")); gtk_label_set_xalign (GTK_LABEL (label), 0.0); @@ -595,7 +595,7 @@ baobab_remote_connect_dialog_init (BaobabRemoteConnectDialog *dialog) GtkListStore *store; GtkCellRenderer *renderer; int i; - + dialog->details = g_new0 (BaobabRemoteConnectDialogDetails, 1); gtk_window_set_title (GTK_WINDOW (dialog), _("Connect to Server")); @@ -613,7 +613,7 @@ baobab_remote_connect_dialog_init (BaobabRemoteConnectDialog *dialog) gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0); gtk_widget_show (hbox); - + label = gtk_label_new_with_mnemonic (_("Service _type:")); gtk_label_set_xalign (GTK_LABEL (label), 0.0); gtk_label_set_yalign (GTK_LABEL (label), 0.5); @@ -680,7 +680,7 @@ baobab_remote_connect_dialog_init (BaobabRemoteConnectDialog *dialog) g_signal_connect (combo, "changed", G_CALLBACK (combo_changed_callback), dialog); - + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0); @@ -690,7 +690,7 @@ baobab_remote_connect_dialog_init (BaobabRemoteConnectDialog *dialog) gtk_widget_show (label); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); - + dialog->details->grid = grid = gtk_grid_new (); gtk_grid_set_row_spacing (GTK_GRID (grid), 6); @@ -725,9 +725,9 @@ baobab_remote_connect_dialog_init (BaobabRemoteConnectDialog *dialog) g_object_ref (dialog->details->folder_entry); g_object_ref (dialog->details->domain_entry); g_object_ref (dialog->details->user_entry); - + setup_for_type (dialog); - + gtk_dialog_add_button (GTK_DIALOG (dialog), "gtk-cancel", GTK_RESPONSE_CANCEL); diff --git a/baobab/src/baobab-remote-connect-dialog.h b/baobab/src/baobab-remote-connect-dialog.h index a6e1c97e..05dbcdfc 100644 --- a/baobab/src/baobab-remote-connect-dialog.h +++ b/baobab/src/baobab-remote-connect-dialog.h @@ -53,7 +53,7 @@ struct _BaobabRemoteConnectDialogClass { }; GType baobab_remote_connect_dialog_get_type (void); -GtkWidget* baobab_remote_connect_dialog_new (GtkWindow *window, +GtkWidget* baobab_remote_connect_dialog_new (GtkWindow *window, GFile *location); #endif /* BAOBAB_REMOTE_CONNECT_DIALOG_H */ diff --git a/baobab/src/baobab-ringschart.h b/baobab/src/baobab-ringschart.h index 276bd7fe..f63d4fff 100644 --- a/baobab/src/baobab-ringschart.h +++ b/baobab/src/baobab-ringschart.h @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301 USA * * Authors: @@ -53,7 +53,7 @@ typedef struct _BaobabRingschartPrivate BaobabRingschartPrivate; struct _BaobabRingschart { BaobabChart parent; - + BaobabRingschartPrivate *priv; }; @@ -64,7 +64,7 @@ struct _BaobabRingschartClass GType baobab_ringschart_get_type (void) G_GNUC_CONST; GtkWidget *baobab_ringschart_new (void); -void baobab_ringschart_set_subfoldertips_enabled (GtkWidget *chart, +void baobab_ringschart_set_subfoldertips_enabled (GtkWidget *chart, gboolean enabled); G_END_DECLS diff --git a/baobab/src/baobab-scan.c b/baobab/src/baobab-scan.c index 8c85d859..824004ff 100644 --- a/baobab/src/baobab-scan.c +++ b/baobab/src/baobab-scan.c @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301 USA */ @@ -211,13 +211,13 @@ loopdir (GFile *file, if (is_in_dot_gvfs (file)) goto exit; - parse_name = g_file_get_parse_name (file); + parse_name = g_file_get_parse_name (file); if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_STANDARD_SIZE)) retloop.size = g_file_info_get_size (info); if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_UNIX_BLOCKS)) - retloop.alloc_size = BLOCK_SIZE * + retloop.alloc_size = BLOCK_SIZE * g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_UNIX_BLOCKS); @@ -269,7 +269,7 @@ loopdir (GFile *file, /* is a directory? */ if (temp_type == G_FILE_TYPE_DIRECTORY) { - GFile *child_dir = g_file_get_child (file, + GFile *child_dir = g_file_get_child (file, g_file_info_get_name (temp_info)); temp = loopdir (child_dir, temp_info, count, hla, current_depth+1); retloop.size += temp.size; @@ -281,13 +281,13 @@ loopdir (GFile *file, /* is it a regular file? */ else if (temp_type == G_FILE_TYPE_REGULAR) { - + /* check for hard links only on local files */ if (g_file_info_has_attribute (temp_info, G_FILE_ATTRIBUTE_UNIX_NLINK) && g_file_info_get_attribute_uint32 (temp_info, G_FILE_ATTRIBUTE_UNIX_NLINK) > 1) { - + if (!baobab_hardlinks_array_add (hla, temp_info)) { /* we already acconted for it */ @@ -313,7 +313,7 @@ loopdir (GFile *file, /* won't be an error if we've finished normally */ if (err != NULL) { - g_warning ("error in dir %s: %s\n", + g_warning ("error in dir %s: %s\n", parse_name, err->message); } diff --git a/baobab/src/baobab-scan.h b/baobab/src/baobab-scan.h index c6400d56..2ef8ab1f 100644 --- a/baobab/src/baobab-scan.h +++ b/baobab/src/baobab-scan.h @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301 USA */ diff --git a/baobab/src/baobab-treeview.c b/baobab/src/baobab-treeview.c index 2a3aad3f..eb6beb5e 100644 --- a/baobab/src/baobab-treeview.c +++ b/baobab/src/baobab-treeview.c @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301 USA */ @@ -79,7 +79,7 @@ on_tv_cur_changed (GtkTreeView *treeview, gpointer data) static void contents_changed (void) { - if (messageyesno (_("Rescan your home folder?"), + if (messageyesno (_("Rescan your home folder?"), _("The content of your home folder has changed. Select rescan to update the disk usage details."), GTK_MESSAGE_QUESTION, _("_Rescan"), baobab.window) == GTK_RESPONSE_OK) { baobab_rescan_current_dir (); @@ -103,7 +103,7 @@ on_tv_button_press (GtkWidget *widget, event->x, event->y, &path, NULL, NULL, NULL); if (!path) - return TRUE; + return TRUE; /* get the selected path */ g_free (baobab.selected_path); @@ -223,7 +223,7 @@ create_directory_treeview (void) gtk_tree_view_column_set_sizing (col, GTK_TREE_VIEW_COLUMN_AUTOSIZE); gtk_tree_view_column_set_resizable (col, TRUE); gtk_tree_view_append_column (GTK_TREE_VIEW (tvw), col); - + /* percentage bar & text column */ col = gtk_tree_view_column_new (); @@ -291,7 +291,7 @@ create_directory_treeview (void) GTK_POLICY_AUTOMATIC); gtk_tree_view_set_search_equal_func (GTK_TREE_VIEW (tvw), - baobab_treeview_equal_func, + baobab_treeview_equal_func, NULL, NULL); baobab.model = create_model (); diff --git a/baobab/src/baobab-treeview.h b/baobab/src/baobab-treeview.h index 38aca412..998e88e4 100644 --- a/baobab/src/baobab-treeview.h +++ b/baobab/src/baobab-treeview.h @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301 USA */ diff --git a/baobab/src/baobab-utils.c b/baobab/src/baobab-utils.c index b7539a93..022c3a0d 100644 --- a/baobab/src/baobab-utils.c +++ b/baobab/src/baobab-utils.c @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301 USA */ @@ -131,7 +131,7 @@ dir_select (gboolean SEARCH, GtkWidget *parent) gtk_window_set_modal (GTK_WINDOW (file_chooser), TRUE); gtk_window_set_position (GTK_WINDOW (file_chooser), GTK_WIN_POS_CENTER_ON_PARENT); } - + gtk_widget_show (GTK_WIDGET (file_chooser)); return NULL; @@ -187,17 +187,17 @@ show_bars (GtkTreeModel *mdl, if (readelements == -1) { gtk_tree_store_set (GTK_TREE_STORE (mdl), iter, COL_DIR_SIZE, "--", - COL_ELEMENTS, "--", -1); + COL_ELEMENTS, "--", -1); return FALSE; } gtk_tree_model_get (mdl, &parent, COL_H_ELEMENTS, &readelements, -1); - + gtk_tree_model_get (mdl, iter, size_col, &size, -1); - + sizecstr = g_format_size (size); - + if (readelements == -1) { gtk_tree_store_set (GTK_TREE_STORE (mdl), iter, COL_DIR_SIZE, sizecstr, -1); @@ -221,9 +221,9 @@ show_bars (GtkTreeModel *mdl, if (readelements != -1) { gtk_tree_model_get (mdl, iter, size_col, &size, -1); - + sizecstr = g_format_size (size); - + gtk_tree_store_set (GTK_TREE_STORE (mdl), iter, COL_H_PERC, 100.0, COL_DIR_SIZE, sizecstr, -1); @@ -279,7 +279,7 @@ messageyesno (const gchar *primary_msg, button = gtk_button_new_with_mnemonic (ok_button); gtk_widget_set_can_default (button, TRUE); gtk_widget_show (button); - + gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, GTK_RESPONSE_OK); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); response = gtk_dialog_run (GTK_DIALOG (dialog)); @@ -311,11 +311,11 @@ baobab_check_dir (GFile *file) g_error_free (error); return FALSE; - } + } if ((g_file_info_get_file_type (info) != G_FILE_TYPE_DIRECTORY) || is_virtual_filesystem(file)) { - + char *error_msg = NULL; gchar *name = NULL; @@ -323,7 +323,7 @@ baobab_check_dir (GFile *file) error_msg = g_strdup_printf (_("\"%s\" is not a valid folder"), name); - message (error_msg, _("Could not analyze disk usage."), + message (error_msg, _("Could not analyze disk usage."), GTK_MESSAGE_ERROR, baobab.window); g_free (error_msg); @@ -389,14 +389,14 @@ open_file_with_application (GFile *file) NULL, NULL); if (!info) return; - + content = g_file_info_get_content_type (info); application = g_app_info_get_default_for_type (content, TRUE); if (!application) { - primary = g_strdup_printf (_("Could not open folder \"%s\""), + primary = g_strdup_printf (_("Could not open folder \"%s\""), g_file_get_basename (file)); - message (primary, + message (primary, _("There is no installed viewer capable " "of displaying the folder."), GTK_MESSAGE_ERROR, @@ -480,9 +480,9 @@ trash_file (GFile *file) g_free (mess); g_error_free (error); - return FALSE; + return FALSE; } - + return TRUE; } @@ -495,7 +495,7 @@ baobab_help_display (GtkWindow *parent, char *uri; gboolean ret; - uri = (link_id) ? + uri = (link_id) ? g_strdup_printf ("help:%s/%s", file_name, link_id) : g_strdup_printf ("help:%s", file_name); @@ -511,7 +511,7 @@ baobab_help_display (GtkWindow *parent, dialog = gtk_message_dialog_new (parent, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, + GTK_BUTTONS_CLOSE, _("There was an error displaying help.")); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), @@ -533,7 +533,7 @@ is_virtual_filesystem (GFile *file) { gboolean ret = FALSE; char *path; - + path = g_file_get_path (file); /* FIXME: we need a better way to check virtual FS */ diff --git a/baobab/src/baobab-utils.h b/baobab/src/baobab-utils.h index 27428313..7ef23987 100644 --- a/baobab/src/baobab-utils.h +++ b/baobab/src/baobab-utils.h @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301 USA */ diff --git a/baobab/src/baobab.c b/baobab/src/baobab.c index 36de4256..5a30948c 100644 --- a/baobab/src/baobab.c +++ b/baobab/src/baobab.c @@ -177,7 +177,7 @@ update_scan_label (void) total = g_format_size (baobab.fs.total); used = g_format_size (baobab.fs.used); available = g_format_size (baobab.fs.avail); - + /* Translators: these are labels for disk space */ markup = g_markup_printf_escaped ("<small>%s <b>%s</b> (%s %s %s %s )</small>", _("Total filesystem capacity:"), total, @@ -402,9 +402,9 @@ first_row (void) gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (baobab.tree_view), FALSE); gtk_tree_store_append (baobab.model, &firstiter, &root_iter); - + size = g_format_size (baobab.fs.used); - + if (baobab.fs.total == 0 && baobab.fs.used == 0) { perc = 100.0; } else { @@ -452,7 +452,7 @@ baobab_fill_model (struct chan_data *data) hardlinks = g_string_new (""); if (data->tempHLsize > 0) { size = g_format_size (data->tempHLsize); - + g_string_assign (hardlinks, "<i>("); g_string_append (hardlinks, _("contains hardlinks for:")); g_string_append (hardlinks, " "); @@ -857,7 +857,7 @@ baobab_init (void) /* Settings */ baobab.ui_settings = g_settings_new (BAOBAB_UI_SETTINGS_SCHEMA); baobab.prefs_settings = g_settings_new (BAOBAB_PREFS_SETTINGS_SCHEMA); - + /* Misc */ baobab.CONTENTS_CHANGED_DELAYED = FALSE; baobab.STOP_SCANNING = TRUE; diff --git a/baobab/src/baobab.h b/baobab/src/baobab.h index eb7c4a58..b8d01817 100644 --- a/baobab/src/baobab.h +++ b/baobab/src/baobab.h @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301 USA */ diff --git a/baobab/src/callbacks.h b/baobab/src/callbacks.h index 0f517968..d823cc32 100644 --- a/baobab/src/callbacks.h +++ b/baobab/src/callbacks.h @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301 USA */ diff --git a/gsearchtool/libeggsmclient/eggsmclient-xsmp.c b/gsearchtool/libeggsmclient/eggsmclient-xsmp.c index 97813788..2fef4df1 100644 --- a/gsearchtool/libeggsmclient/eggsmclient-xsmp.c +++ b/gsearchtool/libeggsmclient/eggsmclient-xsmp.c @@ -227,7 +227,7 @@ sm_client_xsmp_set_initial_properties (gpointer user_data) if (xsmp->restart_style == SmRestartIfRunning) { - if (egg_desktop_file_get_boolean (desktop_file, + if (egg_desktop_file_get_boolean (desktop_file, "X-MATE-AutoRestart", NULL)) xsmp->restart_style = SmRestartImmediately; } @@ -1127,7 +1127,7 @@ delete_properties (EggSMClientXSMP *xsmp, ...) * until you're done with the SmProp. */ static SmProp * -array_prop (const char *name, ...) +array_prop (const char *name, ...) { SmProp *prop; SmPropValue pv; @@ -1343,13 +1343,13 @@ ice_error_handler (IceConn ice_conn, IcePointer values) { /* Do nothing */ -} +} static void ice_io_error_handler (IceConn ice_conn) { /* Do nothing */ -} +} static void smc_error_handler (SmcConn smc_conn, diff --git a/gsearchtool/libeggsmclient/eggsmclient.c b/gsearchtool/libeggsmclient/eggsmclient.c index da0a0f2d..2fdf7dbb 100644 --- a/gsearchtool/libeggsmclient/eggsmclient.c +++ b/gsearchtool/libeggsmclient/eggsmclient.c @@ -112,7 +112,7 @@ egg_sm_client_class_init (EggSMClientClass *klass) * handling this signal; if the user has requested that the session * be saved when logging out, then ::save_state will be emitted * separately. - * + * * If the application agrees to quit, it should then wait for either * the ::quit_cancelled or ::quit signals to be emitted. **/ diff --git a/gsearchtool/src/gsearchtool-callbacks.c b/gsearchtool/src/gsearchtool-callbacks.c index da8b7bda..b20aed79 100644 --- a/gsearchtool/src/gsearchtool-callbacks.c +++ b/gsearchtool/src/gsearchtool-callbacks.c @@ -186,7 +186,7 @@ click_help_cb (GtkWidget * widget, GtkWidget * window = data; GError * error = NULL; - gtk_show_uri_on_window (GTK_WINDOW (window), "help:mate-search-tool", + gtk_show_uri_on_window (GTK_WINDOW (window), "help:mate-search-tool", gtk_get_current_event_time (), &error); if (error) { @@ -922,17 +922,17 @@ move_to_trash_cb (GtkAction * action, /* Bugzilla #397945: Select next row in the search results list */ if (last_selected_path != NULL) { if (gtk_tree_selection_count_selected_rows (GTK_TREE_SELECTION (gsearch->search_results_selection)) == 0) { - gtk_tree_selection_select_path (GTK_TREE_SELECTION (gsearch->search_results_selection), + gtk_tree_selection_select_path (GTK_TREE_SELECTION (gsearch->search_results_selection), last_selected_path); if (gtk_tree_selection_count_selected_rows (GTK_TREE_SELECTION (gsearch->search_results_selection)) == 0) { gtk_tree_path_prev (last_selected_path); - gtk_tree_selection_select_path (GTK_TREE_SELECTION (gsearch->search_results_selection), + gtk_tree_selection_select_path (GTK_TREE_SELECTION (gsearch->search_results_selection), last_selected_path); } } gtk_tree_path_free (last_selected_path); } - + if (gsearch->command_details->command_status != RUNNING) { update_search_counts (gsearch); } @@ -1051,7 +1051,7 @@ build_popup_menu_for_file (GSearchWindow * gsearch, GList * list; gchar * str; gint list_length; - + g_file = g_file_new_for_path (file); file_info = g_file_query_info (g_file, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, G_FILE_QUERY_INFO_NONE, NULL, NULL); list = g_app_info_get_all_for_type (g_file_info_get_content_type (file_info)); @@ -1084,7 +1084,7 @@ build_popup_menu_for_file (GSearchWindow * gsearch, list = g_list_prepend (list, tmp->data); g_list_free (tmp); } - + /* Popup menu item: Open with (default) */ str = g_strdup_printf (_("_Open with %s"), g_app_info_get_name (list->data)); new1 = gtk_image_menu_item_new_with_mnemonic (str); @@ -1111,11 +1111,11 @@ build_popup_menu_for_file (GSearchWindow * gsearch, gtk_widget_show (image1); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (new1), image1); } - + separatormenuitem1 = gtk_separator_menu_item_new (); gtk_widget_show (separatormenuitem1); gtk_container_add (GTK_CONTAINER (gsearch->search_results_popup_menu), separatormenuitem1); - gtk_widget_set_sensitive (separatormenuitem1, FALSE); + gtk_widget_set_sensitive (separatormenuitem1, FALSE); for (list = g_list_next (list), i = 0; list != NULL; list = g_list_next (list), i++) { @@ -1126,7 +1126,7 @@ build_popup_menu_for_file (GSearchWindow * gsearch, else { str = g_strdup_printf ("%s", g_app_info_get_name (list->data)); } - + new1 = gtk_image_menu_item_new_with_mnemonic (str); g_free (str); gtk_widget_show (new1); @@ -1143,13 +1143,13 @@ build_popup_menu_for_file (GSearchWindow * gsearch, if (file_icon == NULL) { file_icon = g_themed_icon_new ("gtk-open"); } - + image1 = gtk_image_new_from_gicon (file_icon, GTK_ICON_SIZE_MENU); g_object_unref (file_icon); gtk_widget_show (image1); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (new1), image1); } - + if (i == 0) { gsearch->search_results_popup_submenu = gtk_menu_new (); @@ -1162,9 +1162,9 @@ build_popup_menu_for_file (GSearchWindow * gsearch, } gtk_container_add (GTK_CONTAINER (gsearch->search_results_popup_submenu), new1); - /* For submenu items, the "activate" signal is only emitted if the user first clicks + /* For submenu items, the "activate" signal is only emitted if the user first clicks on the parent menu item. Since submenus in gtk+ are automatically displayed when - the user hovers over them, most will never click on the parent menu item. + the user hovers over them, most will never click on the parent menu item. The work-around is to connect to "button-press-event". */ g_signal_connect (G_OBJECT(new1), "button-press-event", G_CALLBACK (open_file_event_cb), (gpointer) gsearch); @@ -1178,7 +1178,7 @@ build_popup_menu_for_file (GSearchWindow * gsearch, if (file_icon == NULL) { file_icon = g_themed_icon_new ("gtk-open"); } - + image1 = gtk_image_new_from_gicon (file_icon, GTK_ICON_SIZE_MENU); g_object_unref (file_icon); gtk_widget_show (image1); @@ -1189,7 +1189,7 @@ build_popup_menu_for_file (GSearchWindow * gsearch, (gpointer) gsearch); } } - + if (list_length >= 2) { separatormenuitem1 = gtk_separator_menu_item_new (); gtk_container_add (GTK_CONTAINER (gsearch->search_results_popup_menu), separatormenuitem1); @@ -1255,7 +1255,7 @@ build_popup_menu_for_file (GSearchWindow * gsearch, "activate", G_CALLBACK (show_file_selector_cb), (gpointer) gsearch); -} +} gboolean file_button_release_event_cb (GtkWidget * widget, @@ -1332,7 +1332,7 @@ file_button_release_event_cb (GtkWidget * widget, /* Verify the selected files each have the same default handler. */ for (tmp = g_list_first (list), idx = 0; tmp != NULL; tmp = g_list_next (tmp), idx++) { - + GFile * g_file; GAppInfo * app_info; @@ -1350,7 +1350,7 @@ file_button_release_event_cb (GtkWidget * widget, show_app_list = FALSE; } else { - if (idx == 0) { + if (idx == 0) { first_app_info = g_app_info_dup (app_info); g_object_unref (app_info); continue; @@ -1376,7 +1376,7 @@ file_button_release_event_cb (GtkWidget * widget, g_object_unref (first_app_info); } } - + file = g_strdup (((show_app_list == TRUE) ? locale_file_first : NULL)); build_popup_menu_for_file (gsearch, file); diff --git a/gsearchtool/src/gsearchtool.c b/gsearchtool/src/gsearchtool.c index 68c14b80..a788edf4 100644 --- a/gsearchtool/src/gsearchtool.c +++ b/gsearchtool/src/gsearchtool.c @@ -279,19 +279,19 @@ setup_case_insensitive_arguments (GSearchWindow * gsearch) if ((cmd_stderr != NULL) && (strlen (cmd_stderr) == 0)) { g_free (cmd_stderr); g_free (grep_cmd); - + /* check grep command for -I argument compatibility, bug 568840 */ grep_cmd = g_strdup_printf ("%s -i -I 'string' /dev/null", GREP_COMMAND); g_spawn_command_line_sync (grep_cmd, NULL, &cmd_stderr, NULL, NULL); - + if ((cmd_stderr != NULL) && (strlen (cmd_stderr) == 0)) { GSearchOptionTemplates[SEARCH_CONSTRAINT_CONTAINS_THE_TEXT].option = g_strdup_printf ("'!' -type p -exec %s -i -I -c '%%s' {} \\;", GREP_COMMAND); } else { GSearchOptionTemplates[SEARCH_CONSTRAINT_CONTAINS_THE_TEXT].option = - g_strdup_printf ("'!' -type p -exec %s -i -c '%%s' {} \\;", GREP_COMMAND); - } + g_strdup_printf ("'!' -type p -exec %s -i -c '%%s' {} \\;", GREP_COMMAND); + } } else { GSearchOptionTemplates[SEARCH_CONSTRAINT_CONTAINS_THE_TEXT].option = @@ -867,7 +867,7 @@ add_file_to_search_results (const gchar * file, if (gtk_tree_view_get_headers_visible (GTK_TREE_VIEW (gsearch->search_results_tree_view)) == FALSE) { gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (gsearch->search_results_tree_view), TRUE); } - + g_file = g_file_new_for_path (file); file_info = g_file_query_info (g_file, "standard::*,time::modified,thumbnail::path", 0, NULL, NULL); @@ -876,7 +876,7 @@ add_file_to_search_results (const gchar * file, readable_size = g_format_size (g_file_info_get_size (file_info)); g_file_info_get_modification_time (file_info, &time_val); - readable_date = get_readable_date (gsearch->search_results_date_format, time_val.tv_sec); + readable_date = get_readable_date (gsearch->search_results_date_format, time_val.tv_sec); base_name = g_path_get_basename (file); dir_name = g_path_get_dirname (file); @@ -1919,7 +1919,7 @@ spawn_search_command (GSearchWindow * gsearch, gtk_tree_model_foreach (GTK_TREE_MODEL (gsearch->search_results_list_store), (GtkTreeModelForeachFunc) tree_model_iter_free_monitor, gsearch); gtk_list_store_clear (GTK_LIST_STORE (gsearch->search_results_list_store)); - + gtk_tree_view_column_set_visible (gsearch->search_results_folder_column, TRUE); gtk_tree_view_column_set_visible (gsearch->search_results_size_column, TRUE); gtk_tree_view_column_set_visible (gsearch->search_results_type_column, TRUE); @@ -2311,7 +2311,7 @@ create_search_results_section (GSearchWindow * gsearch) gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0); gsearch->progress_spinner = gtk_spinner_new (); - gtk_widget_set_size_request (gsearch->progress_spinner, + gtk_widget_set_size_request (gsearch->progress_spinner, GTK_ICON_SIZE_MENU, GTK_ICON_SIZE_MENU); gtk_box_pack_start (GTK_BOX (hbox), gsearch->progress_spinner, FALSE, FALSE, 0); @@ -2553,7 +2553,7 @@ set_clone_command (GSearchWindow * gsearch, g_free (file_is_named_locale); look_in_folder_locale = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (gsearch->look_in_folder_button)); - + if (look_in_folder_locale == NULL) { look_in_folder_locale = g_strdup (""); } @@ -2843,12 +2843,12 @@ gsearch_app_create (GSearchWindow * gsearch) locale_string = g_settings_get_string (gsearch->mate_search_tool_settings, "look-in-folder"); - if ((g_file_test (locale_string, G_FILE_TEST_EXISTS) == FALSE) || + if ((g_file_test (locale_string, G_FILE_TEST_EXISTS) == FALSE) || (g_file_test (locale_string, G_FILE_TEST_IS_DIR) == FALSE)) { g_free (locale_string); locale_string = g_get_current_dir (); } - + utf8_string = g_filename_to_utf8 (locale_string, -1, NULL, NULL, NULL); gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (gsearch->look_in_folder_button), utf8_string); diff --git a/logview/src/logview-app.c b/logview/src/logview-app.c index 6d30e682..ebccf03b 100644 --- a/logview/src/logview-app.c +++ b/logview/src/logview-app.c @@ -184,7 +184,7 @@ enumerate_next_files_async_cb (GObject *source, type = g_file_info_get_file_type (info); content_type = g_file_info_get_content_type (info); name = g_file_info_get_name (info); - + if (!g_file_info_get_attribute_boolean (info, "access::can-read")) { g_object_unref (info); continue; @@ -245,7 +245,7 @@ enumerate_children_async_cb (GObject *source, g_file_enumerator_next_files_async (enumerator, G_MAXINT, G_PRIORITY_DEFAULT, - NULL, enumerate_next_files_async_cb, job); + NULL, enumerate_next_files_async_cb, job); } static void diff --git a/logview/src/logview-app.h b/logview/src/logview-app.h index 3ce7c059..e1a5d021 100644 --- a/logview/src/logview-app.h +++ b/logview/src/logview-app.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ - + #ifndef __LOGVIEW_APP_H__ #define __LOGVIEW_APP_H__ diff --git a/logview/src/logview-filter-manager.c b/logview/src/logview-filter-manager.c index c4c5057b..3d2c470e 100644 --- a/logview/src/logview-filter-manager.c +++ b/logview/src/logview-filter-manager.c @@ -63,7 +63,7 @@ logview_filter_manager_update_model (LogviewFilterManager *manager) gtk_list_store_clear (GTK_LIST_STORE (manager->priv->model)); - filters = logview_prefs_get_filters (manager->priv->prefs); + filters = logview_prefs_get_filters (manager->priv->prefs); for (filter = filters; filter != NULL; filter = g_list_next (filter)) { g_object_get (filter->data, "name", &name, NULL); @@ -78,7 +78,7 @@ logview_filter_manager_update_model (LogviewFilterManager *manager) g_free (name); } - g_list_free (filters); + g_list_free (filters); } static gboolean @@ -161,7 +161,7 @@ check_regex (LogviewFilterManager *manager, const gchar *regex) static void on_check_toggled (GtkToggleButton *button, GtkWidget *widget) { - gtk_widget_set_sensitive (widget, + gtk_widget_set_sensitive (widget, gtk_toggle_button_get_active (button)); } @@ -214,7 +214,7 @@ on_dialog_add_edit_reponse (GtkWidget *dialog, int response_id, GdkRGBA foreground_color; gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (color_foreground), &foreground_color); - g_object_set (G_OBJECT (tag), + g_object_set (G_OBJECT (tag), "foreground-rgba", &foreground_color, "foreground-set", TRUE, NULL); } @@ -223,11 +223,11 @@ on_dialog_add_edit_reponse (GtkWidget *dialog, int response_id, GdkRGBA background_color; gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (color_background), &background_color); - g_object_set (tag, + g_object_set (tag, "paragraph-background-rgba", &background_color, "paragraph-background-set", TRUE, NULL); } - + if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_foreground)) && !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_background))) { GtkWidget *error_dialog; @@ -282,7 +282,7 @@ run_add_edit_dialog (LogviewFilterManager *manager, LogviewFilter *filter) error = NULL; name = NULL; - + gtk_builder_add_from_file (builder, UI_FILE, &error); if (error) { @@ -395,7 +395,7 @@ run_add_edit_dialog (LogviewFilterManager *manager, LogviewFilter *filter) static void on_add_clicked (GtkWidget *button, LogviewFilterManager *manager) -{ +{ run_add_edit_dialog (manager, NULL); } @@ -426,7 +426,7 @@ on_remove_clicked (GtkWidget *button, LogviewFilterManager *manager) GtkTreeModel *model; gchar *name; - selection = + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (manager->priv->tree)); gtk_tree_selection_get_selected (selection, &model, &iter); @@ -446,7 +446,7 @@ on_tree_selection_changed (GtkTreeSelection *selection, LogviewFilterManager *ma status = gtk_tree_selection_get_selected (selection, NULL, NULL); gtk_widget_set_sensitive (manager->priv->edit_button, status); - gtk_widget_set_sensitive (manager->priv->remove_button, status); + gtk_widget_set_sensitive (manager->priv->remove_button, status); } static void @@ -521,11 +521,11 @@ logview_filter_manager_init (LogviewFilterManager *manager) gtk_window_set_title (GTK_WINDOW (manager), _("Filters")); - g_signal_connect (priv->add_button, "clicked", + g_signal_connect (priv->add_button, "clicked", G_CALLBACK (on_add_clicked), manager); - g_signal_connect (priv->edit_button, "clicked", + g_signal_connect (priv->edit_button, "clicked", G_CALLBACK (on_edit_clicked), manager); - g_signal_connect (priv->remove_button, "clicked", + g_signal_connect (priv->remove_button, "clicked", G_CALLBACK (on_remove_clicked), manager); gtk_widget_set_sensitive (priv->edit_button, FALSE); diff --git a/logview/src/logview-filter-manager.h b/logview/src/logview-filter-manager.h index c33ea1f7..864ec94c 100644 --- a/logview/src/logview-filter-manager.h +++ b/logview/src/logview-filter-manager.h @@ -2,17 +2,17 @@ /* * mate-utils * Copyright (C) Johannes Schmid 2009 <[email protected]> - * + * * mate-utils is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * mate-utils is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ diff --git a/logview/src/logview-filter.c b/logview/src/logview-filter.c index b5f9cfc6..1a865fa8 100644 --- a/logview/src/logview-filter.c +++ b/logview/src/logview-filter.c @@ -2,17 +2,17 @@ /* * mate-utils * Copyright (C) Johannes Schmid 2009 <[email protected]> - * + * * mate-utils is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * mate-utils is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ @@ -42,7 +42,7 @@ struct _LogviewFilterPrivate { (G_TYPE_INSTANCE_GET_PRIVATE ((o), LOGVIEW_TYPE_FILTER, LogviewFilterPrivate)) static void -logview_filter_init (LogviewFilter *object) +logview_filter_init (LogviewFilter *object) { object->priv = LOGVIEW_FILTER_GET_PRIVATE(object); object->priv->tag = NULL; @@ -77,7 +77,7 @@ logview_filter_set_property (GObject *object, guint prop_id, const GValue *value const gchar* regex; err = NULL; - + regex = g_value_get_string (value); priv->regex = g_regex_new (regex, 0, 0, &err); diff --git a/logview/src/logview-filter.h b/logview/src/logview-filter.h index 6eb827b8..a5414259 100644 --- a/logview/src/logview-filter.h +++ b/logview/src/logview-filter.h @@ -2,17 +2,17 @@ /* * mate-utils * Copyright (C) Johannes Schmid 2009 <[email protected]> - * + * * mate-utils is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * mate-utils is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ @@ -48,9 +48,9 @@ struct _LogviewFilter { }; GType logview_filter_get_type (void) G_GNUC_CONST; -LogviewFilter * logview_filter_new (const gchar *name, +LogviewFilter * logview_filter_new (const gchar *name, const gchar *regex); -gboolean logview_filter_filter (LogviewFilter *filter, +gboolean logview_filter_filter (LogviewFilter *filter, const gchar *line); GtkTextTag * logview_filter_get_tag (LogviewFilter *filter); diff --git a/logview/src/logview-findbar.c b/logview/src/logview-findbar.c index 846f7de5..5632784f 100644 --- a/logview/src/logview-findbar.c +++ b/logview/src/logview-findbar.c @@ -38,7 +38,7 @@ struct _LogviewFindbarPrivate { GtkToolItem *forward_button; GtkToolItem *status_item; GtkToolItem *separator; - + char *string; guint status_bold_id; @@ -147,14 +147,14 @@ unbold_timeout_cb (gpointer user_data) return FALSE; } -static void +static void logview_findbar_init (LogviewFindbar *findbar) { GtkWidget *label, *w, *box; GtkToolbar *gtoolbar; GtkToolItem *item; LogviewFindbarPrivate *priv; - + priv = findbar->priv = GET_PRIVATE (findbar); gtoolbar = GTK_TOOLBAR (findbar); @@ -341,11 +341,11 @@ logview_findbar_set_message (LogviewFindbar *findbar, pango_font_description_set_weight (desc, PANGO_WEIGHT_BOLD); gtk_widget_override_font (findbar->priv->message, desc); pango_font_description_free (desc); - + findbar->priv->status_bold_id = g_timeout_add (600, unbold_timeout_cb, findbar); } - gtk_label_set_text (GTK_LABEL (findbar->priv->message), + gtk_label_set_text (GTK_LABEL (findbar->priv->message), text != NULL ? text : ""); g_object_set (findbar->priv->separator, "visible", text != NULL, NULL); g_object_set (findbar->priv->status_item, "visible", text != NULL, NULL); diff --git a/logview/src/logview-log.c b/logview/src/logview-log.c index c41889a2..c9a7150e 100644 --- a/logview/src/logview-log.c +++ b/logview/src/logview-log.c @@ -190,7 +190,7 @@ setup_file_monitor (LogviewLog *log) g_error_free (err); return; } - + /* set the rate to 1sec, as I guess it's not unusual to have more than * one line written consequently or in a short time, being a log file. */ @@ -232,7 +232,7 @@ add_new_days_to_cache (LogviewLog *log, const char **new_lines, guint lines_offs log->priv->days = g_slist_append (log->priv->days, logview_utils_day_copy (day)); } else if (res == 0) { last = last_cached->data; - + /* update the lines number */ last->last_line += day->last_line; } @@ -371,7 +371,7 @@ skip_string (GInputStream *is) } while (c != 0); return TRUE; -} +} static gboolean read_gzip_header (GInputStream *is, @@ -407,7 +407,7 @@ read_gzip_header (GInputStream *is, guchar tmp[2]; bytes = g_input_stream_read (is, tmp, 2, NULL, NULL); - + if (bytes != 2) { return FALSE; } @@ -573,7 +573,7 @@ gz_handle_read (GZHandle *gz, } else if (z_result != Z_OK) { gz->last_z_result = z_result; } - + if (gz->last_z_result != Z_OK && zstream->avail_out == num_bytes) { return result_from_z_result (gz->last_z_result); } @@ -725,7 +725,7 @@ log_load (GIOSchedulerJob *io_job, err = create_zlib_error (); goto out; } - + g_object_unref (is); is = real_is; diff --git a/logview/src/logview-log.h b/logview/src/logview-log.h index 4f81af14..5c359195 100644 --- a/logview/src/logview-log.h +++ b/logview/src/logview-log.h @@ -40,7 +40,7 @@ G_BEGIN_DECLS (G_TYPE_CHECK_CLASS_TYPE ((klass), LOGVIEW_TYPE_LOG)) #define LOGVIEW_LOG_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), LOGVIEW_TYPE_LOG, LogviewLogClass)) - + typedef struct _LogviewLog LogviewLog; typedef struct _LogviewLogClass LogviewLogClass; typedef struct _LogviewLogPrivate LogviewLogPrivate; diff --git a/logview/src/logview-loglist.c b/logview/src/logview-loglist.c index 847626d9..bc0f1beb 100644 --- a/logview/src/logview-loglist.c +++ b/logview/src/logview-loglist.c @@ -205,7 +205,7 @@ tree_selection_changed_cb (GtkTreeSelection *selection, gtk_tree_model_get (model, &parent, LOG_OBJECT, &log, -1); if (!logview_manager_log_is_active (list->priv->manager, log)) { - save_day_selection (list, &iter); + save_day_selection (list, &iter); logview_manager_set_active_log (list->priv->manager, log); } else { g_signal_emit (list, signals[DAY_SELECTED], 0, day, NULL); @@ -232,7 +232,7 @@ manager_active_changed_cb (LogviewManager *manager, GtkTreeIter * iter, sel_iter; GtkTreeSelection * selection; - if (list->priv->selection && + if (list->priv->selection && gtk_tree_model_get_iter (GTK_TREE_MODEL (list->priv->model), &sel_iter, list->priv->selection)) { @@ -392,7 +392,7 @@ do_finalize (GObject *obj) G_OBJECT_CLASS (logview_loglist_parent_class)->finalize (obj); } -static void +static void logview_loglist_init (LogviewLoglist *list) { GtkTreeStore *model; diff --git a/logview/src/logview-loglist.h b/logview/src/logview-loglist.h index ebfbf04f..ac6c9544 100644 --- a/logview/src/logview-loglist.h +++ b/logview/src/logview-loglist.h @@ -43,7 +43,7 @@ typedef struct _LogviewLoglist LogviewLoglist; typedef struct _LogviewLoglistClass LogviewLoglistClass; typedef struct _LogviewLoglistPrivate LogviewLoglistPrivate; -struct _LogviewLoglist { +struct _LogviewLoglist { GtkTreeView parent_instance; LogviewLoglistPrivate *priv; }; diff --git a/logview/src/logview-main.c b/logview/src/logview-main.c index 74dcb44b..7eb43b06 100644 --- a/logview/src/logview-main.c +++ b/logview/src/logview-main.c @@ -92,7 +92,7 @@ main (int argc, char *argv[]) g_critical ("Unable to parse arguments: %s", error->message); g_error_free (error); g_option_context_free (context); - + exit (1); } @@ -103,7 +103,7 @@ main (int argc, char *argv[]) if (!app) { g_critical ("Unable to create the user interface."); - + exit (1); } else { g_signal_connect (app, "app-quit", diff --git a/logview/src/logview-manager.c b/logview/src/logview-manager.c index ca1c423f..17d31201 100644 --- a/logview/src/logview-manager.c +++ b/logview/src/logview-manager.c @@ -127,7 +127,7 @@ logview_manager_init (LogviewManager *self) LogviewManagerPrivate *priv = self->priv = GET_PRIVATE (self); priv->active_log = NULL; - priv->logs = g_hash_table_new_full (g_str_hash, g_str_equal, + priv->logs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); } @@ -202,7 +202,7 @@ create_log_cb (LogviewLog *log, g_free (path); } - + if (data->is_multiple) { op->current++; diff --git a/logview/src/logview-prefs.c b/logview/src/logview-prefs.c index 191f90fb..f61e572f 100644 --- a/logview/src/logview-prefs.c +++ b/logview/src/logview-prefs.c @@ -186,8 +186,8 @@ load_filters (LogviewPrefs *prefs) } g_object_set (filter, "texttag", tag, NULL); - g_hash_table_insert (prefs->priv->filters, - g_strdup(tokens[FILTER_NAME]), + g_hash_table_insert (prefs->priv->filters, + g_strdup(tokens[FILTER_NAME]), filter); g_object_ref (filter); @@ -265,7 +265,7 @@ save_filter_foreach_func (gpointer key, gpointer value, gpointer user_data) g_free (regex); g_object_unref (tag); - + g_ptr_array_add (filters, g_string_free (prefs_string, FALSE)); } diff --git a/logview/src/logview-utils.c b/logview/src/logview-utils.c index c8a61ed1..c74ec399 100644 --- a/logview/src/logview-utils.c +++ b/logview/src/logview-utils.c @@ -71,7 +71,7 @@ logview_utils_day_list_copy (GSList *days) return g_slist_reverse (retval); } -gint +gint days_compare (gconstpointer a, gconstpointer b) { const Day *day1 = a, *day2 = b; @@ -85,7 +85,7 @@ string_get_date (const char *line, char **time_string, int *timestamp_len) GDate *date = NULL; struct tm tp; char *cp = NULL, *timestamp = NULL; - + /* it's safe to assume that if strptime returns NULL, it's * because of an error (format unmatched). being a log file, it's very * unlikely that there aren't any more characters after the date. @@ -133,7 +133,7 @@ out: * and are then corrected to the correct year once we * reach the end. * - * Returns: a #GSList of #Day structures. + * Returns: a #GSList of #Day structures. */ GSList * @@ -216,7 +216,7 @@ log_read_dates (const char **buffer_lines, time_t current) } else { /* we can't find the same date here; go back to a safer range. */ rangemax = i; - i = floor (((float) rangemin + (float) i) / 2.); + i = floor (((float) rangemin + (float) i) / 2.); } } @@ -228,7 +228,7 @@ log_read_dates (const char **buffer_lines, time_t current) * of the buffer: reset the parameters for the next day. */ GDate *newdate = NULL; - + for (i = day->last_line + 1; buffer_lines[i]; i++) { if ((newdate = string_get_date (buffer_lines[i], &date_string, ×tamp_len)) != NULL) break; diff --git a/logview/src/logview-window.c b/logview/src/logview-window.c index 602c3572..6a3e4d9d 100644 --- a/logview/src/logview-window.c +++ b/logview/src/logview-window.c @@ -46,7 +46,7 @@ struct _LogviewWindowPrivate { GtkWidget *find_bar; GtkWidget *loglist; - GtkWidget *sidebar; + GtkWidget *sidebar; GtkWidget *version_bar; GtkWidget *version_selector; GtkWidget *hpaned; @@ -129,7 +129,7 @@ static void populate_tag_table (GtkTextTagTable *tag_table) { GtkTextTag *tag; - + tag = gtk_text_tag_new ("bold"); g_object_set (tag, "weight", PANGO_WEIGHT_BOLD, "weight-set", TRUE, NULL); @@ -142,7 +142,7 @@ populate_tag_table (GtkTextTagTable *tag_table) tag = gtk_text_tag_new ("invisible-filter"); g_object_set (tag, "invisible", TRUE, "invisible-set", TRUE, NULL); - gtk_text_tag_table_add (tag_table, tag); + gtk_text_tag_table_add (tag_table, tag); } static void @@ -217,14 +217,14 @@ logview_update_statusbar (LogviewWindow *logview, LogviewLog *active) modified = g_strdup_printf (_("last update: %s"), timestring_utf8); size = g_format_size (logview_log_get_file_size (active)); - - statusbar_text = g_strdup_printf (_("%d lines (%s) - %s"), + + statusbar_text = g_strdup_printf (_("%d lines (%s) - %s"), logview_log_get_cached_lines_number (active), size, modified); gtk_statusbar_pop (GTK_STATUSBAR (logview->priv->statusbar), 0); gtk_statusbar_push (GTK_STATUSBAR (logview->priv->statusbar), 0, statusbar_text); - + g_free (size); g_free (timestring_utf8); g_free (modified); @@ -371,14 +371,14 @@ logview_bigger_text (GtkAction *action, LogviewWindow *logview) { logview->priv->fontsize = MIN (logview->priv->fontsize + 1, 24); logview_set_fontsize (logview, TRUE); -} +} static void logview_smaller_text (GtkAction *action, LogviewWindow *logview) { logview->priv->fontsize = MAX (logview->priv->fontsize-1, 6); logview_set_fontsize (logview, TRUE); -} +} static void logview_normal_text (GtkAction *action, LogviewWindow *logview) @@ -479,7 +479,7 @@ wrap: } } else { if (wrapped) { - + GtkTextMark *mark; GtkTextIter iter; @@ -535,7 +535,7 @@ text_changed_timeout_cb (gpointer user_data) buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (logview->priv->text_view)); search_start = gtk_text_buffer_get_mark (buffer, SEARCH_START_MARK); search_end = gtk_text_buffer_get_mark (buffer, SEARCH_END_MARK); - + if (search_start) { /* reset the search mark to the start */ gtk_text_buffer_get_start_iter (buffer, &start); @@ -595,7 +595,7 @@ filter_buffer (LogviewWindow *logview, gint start_line) cur_filter = g_list_next (cur_filter)) { if (logview_filter_filter (LOGVIEW_FILTER (cur_filter->data), text)) { - gtk_text_buffer_apply_tag (buffer, + gtk_text_buffer_apply_tag (buffer, logview_filter_get_tag (LOGVIEW_FILTER (cur_filter->data)), &start, end); matched = TRUE; @@ -605,7 +605,7 @@ filter_buffer (LogviewWindow *logview, gint start_line) g_free (text); if (!matched && logview->priv->matches_only) { - gtk_text_buffer_apply_tag_by_name (buffer, + gtk_text_buffer_apply_tag_by_name (buffer, "invisible-filter", &start, end); } else { @@ -621,7 +621,7 @@ filter_buffer (LogviewWindow *logview, gint start_line) static void filter_remove (LogviewWindow *logview, LogviewFilter *filter) { - GtkTextIter start, end; + GtkTextIter start, end; GtkTextBuffer *buffer; buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (logview->priv->text_view)); @@ -639,7 +639,7 @@ on_filter_toggled (GtkToggleAction *action, LogviewWindow *logview) LogviewFilter *filter; name = gtk_action_get_name (GTK_ACTION (action)); - + if (gtk_toggle_action_get_active (action)) { priv->active_filters = g_list_append (priv->active_filters, logview_prefs_get_filter (priv->prefs, @@ -694,7 +694,7 @@ update_filter_menu (LogviewWindow *window) } g_list_free (actions); - + filters = logview_prefs_get_filters (logview_prefs_get ()); id = (g_list_length (filters) > 0) ? gtk_ui_manager_new_merge_id (ui) : 0; @@ -713,7 +713,7 @@ update_filter_menu (LogviewWindow *window) gtk_ui_manager_add_ui (ui, id, FILTER_PLACEHOLDER, name, name, GTK_UI_MANAGER_MENUITEM, FALSE); - gtk_text_tag_table_add (table, + gtk_text_tag_table_add (table, logview_filter_get_tag (LOGVIEW_FILTER (l->data))); g_object_unref (action); @@ -726,7 +726,7 @@ update_filter_menu (LogviewWindow *window) } static void -on_logview_filter_manager_response (GtkDialog *dialog, +on_logview_filter_manager_response (GtkDialog *dialog, gint response, LogviewWindow *logview) { @@ -743,10 +743,10 @@ logview_manage_filters (GtkAction *action, LogviewWindow *logview) manager = logview_filter_manager_new (); - g_signal_connect (manager, "response", + g_signal_connect (manager, "response", G_CALLBACK (on_logview_filter_manager_response), logview); - + gtk_window_set_transient_for (GTK_WINDOW (manager), GTK_WINDOW (logview)); gtk_widget_show (GTK_WIDGET (manager)); @@ -821,14 +821,14 @@ static GtkActionEntry entries[] = { { "FileMenu", NULL, N_("_File"), NULL, NULL, NULL }, { "EditMenu", NULL, N_("_Edit"), NULL, NULL, NULL }, { "ViewMenu", NULL, N_("_View"), NULL, NULL, NULL }, - { "FilterMenu", NULL, N_("_Filters"), NULL, NULL, NULL }, + { "FilterMenu", NULL, N_("_Filters"), NULL, NULL, NULL }, { "HelpMenu", NULL, N_("_Help"), NULL, NULL, NULL }, - { "OpenLog", "document-open", N_("_Open..."), "<control>O", N_("Open a log from file"), + { "OpenLog", "document-open", N_("_Open..."), "<control>O", N_("Open a log from file"), G_CALLBACK (logview_open_log) }, - { "CloseLog", "window-close", N_("_Close"), "<control>W", N_("Close this log"), + { "CloseLog", "window-close", N_("_Close"), "<control>W", N_("Close this log"), G_CALLBACK (logview_close_log) }, - { "Quit", "application-exit", N_("_Quit"), "<control>Q", N_("Quit the log viewer"), + { "Quit", "application-exit", N_("_Quit"), "<control>Q", N_("Quit the log viewer"), G_CALLBACK (gtk_main_quit) }, { "Copy", "edit-copy", N_("_Copy"), "<control>C", N_("Copy the selection"), @@ -847,24 +847,24 @@ static GtkActionEntry entries[] = { { "FilterManage", NULL, N_("Manage Filters"), NULL, N_("Manage filters"), G_CALLBACK (logview_manage_filters)}, - - { "HelpContents", "help-browser", N_("_Contents"), "F1", N_("Open the help contents for the log viewer"), + + { "HelpContents", "help-browser", N_("_Contents"), "F1", N_("Open the help contents for the log viewer"), G_CALLBACK (logview_help) }, - { "AboutAction", "help-about", N_("_About"), NULL, N_("Show the about dialog for the log viewer"), + { "AboutAction", "help-about", N_("_About"), NULL, N_("Show the about dialog for the log viewer"), G_CALLBACK (logview_about) }, }; static GtkToggleActionEntry toggle_entries[] = { { "ShowStatusBar", NULL, N_("_Statusbar"), NULL, N_("Show Status Bar"), G_CALLBACK (logview_toggle_statusbar), TRUE }, - { "ShowSidebar", NULL, N_("Side _Pane"), "F9", N_("Show Side Pane"), - G_CALLBACK (logview_toggle_sidebar), TRUE }, + { "ShowSidebar", NULL, N_("Side _Pane"), "F9", N_("Show Side Pane"), + G_CALLBACK (logview_toggle_sidebar), TRUE }, { "FilterMatchOnly", NULL, N_("Show matches only"), NULL, N_("Only show lines that match one of the given filters"), G_CALLBACK (logview_toggle_match_filters), FALSE} }; -static gboolean -window_size_changed_cb (GtkWidget *widget, GdkEventConfigure *event, +static gboolean +window_size_changed_cb (GtkWidget *widget, GdkEventConfigure *event, gpointer data) { LogviewWindow *window = data; @@ -1181,7 +1181,7 @@ message_area_create_error_box (LogviewWindow *window, GtkWidget *vbox; GtkWidget *primary_label; GtkWidget *secondary_label; - + hbox_content = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8); gtk_widget_show (hbox_content); @@ -1331,7 +1331,7 @@ logview_window_init (LogviewWindow *logview) w = gtk_ui_manager_get_widget (priv->ui_manager, "/LogviewMenu"); gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0); gtk_widget_show (w); - + /* panes */ hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); gtk_box_pack_start (GTK_BOX (vbox), hpaned, TRUE, TRUE, 0); @@ -1462,7 +1462,7 @@ logview_window_init (LogviewWindow *logview) 1); priv->active_filters = NULL; update_filter_menu (logview); - + gtk_widget_show (vbox); gtk_widget_show (main_view); } @@ -1504,7 +1504,7 @@ logview_window_add_error (LogviewWindow *window, priv = window->priv; message_area_set_labels (window, - primary, secondary); + primary, secondary); gtk_widget_show (priv->message_area); diff --git a/mate-dictionary/libgdict/gdict-context-private.h b/mate-dictionary/libgdict/gdict-context-private.h index 30b52c72..023fe273 100644 --- a/mate-dictionary/libgdict/gdict-context-private.h +++ b/mate-dictionary/libgdict/gdict-context-private.h @@ -62,7 +62,7 @@ struct _GdictDatabase { gchar *name; gchar *full_name; - + guint ref_count; }; @@ -70,7 +70,7 @@ struct _GdictStrategy { gchar *name; gchar *description; - + guint ref_count; }; @@ -78,19 +78,19 @@ struct _GdictMatch { gchar *database; gchar *word; - + guint ref_count; }; struct _GdictDefinition { gint total; - + gchar *word; gchar *database_name; gchar *database_full; gchar *definition; - + guint ref_count; }; diff --git a/mate-dictionary/libgdict/gdict-database-chooser.c b/mate-dictionary/libgdict/gdict-database-chooser.c index 8ccc8201..1c9b3740 100644 --- a/mate-dictionary/libgdict/gdict-database-chooser.c +++ b/mate-dictionary/libgdict/gdict-database-chooser.c @@ -59,7 +59,7 @@ struct _GdictDatabaseChooserPrivate GtkWidget *clear_button; GtkWidget *refresh_button; GtkWidget *buttons_box; - + GdictContext *context; gint results; @@ -94,7 +94,7 @@ enum enum { PROP_0, - + PROP_CONTEXT, PROP_COUNT }; @@ -119,25 +119,25 @@ set_gdict_context (GdictDatabaseChooser *chooser, GdictContext *context) { GdictDatabaseChooserPrivate *priv; - + g_assert (GDICT_IS_DATABASE_CHOOSER (chooser)); priv = chooser->priv; - + if (priv->context) { if (priv->start_id) { GDICT_NOTE (CHOOSER, "Removing old context handlers"); - + g_signal_handler_disconnect (priv->context, priv->start_id); g_signal_handler_disconnect (priv->context, priv->match_id); g_signal_handler_disconnect (priv->context, priv->end_id); - + priv->start_id = 0; priv->end_id = 0; priv->match_id = 0; } - + if (priv->error_id) { g_signal_handler_disconnect (priv->context, priv->error_id); @@ -146,7 +146,7 @@ set_gdict_context (GdictDatabaseChooser *chooser, } GDICT_NOTE (CHOOSER, "Removing old context"); - + g_object_unref (G_OBJECT (priv->context)); priv->context = NULL; @@ -164,7 +164,7 @@ set_gdict_context (GdictDatabaseChooser *chooser, } GDICT_NOTE (CHOOSER, "Setting new context"); - + priv->context = g_object_ref (context); priv->results = 0; } @@ -176,7 +176,7 @@ gdict_database_chooser_finalize (GObject *gobject) GdictDatabaseChooserPrivate *priv = chooser->priv; g_free (priv->current_db); - + G_OBJECT_CLASS (gdict_database_chooser_parent_class)->finalize (gobject); } @@ -210,7 +210,7 @@ gdict_database_chooser_set_property (GObject *gobject, GParamSpec *pspec) { GdictDatabaseChooser *chooser = GDICT_DATABASE_CHOOSER (gobject); - + switch (prop_id) { case PROP_CONTEXT: @@ -229,7 +229,7 @@ gdict_database_chooser_get_property (GObject *gobject, GParamSpec *pspec) { GdictDatabaseChooser *chooser = GDICT_DATABASE_CHOOSER (gobject); - + switch (prop_id) { case PROP_CONTEXT: @@ -400,7 +400,7 @@ static void gdict_database_chooser_class_init (GdictDatabaseChooserClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - + gobject_class->finalize = gdict_database_chooser_finalize; gobject_class->dispose = gdict_database_chooser_dispose; gobject_class->set_property = gdict_database_chooser_set_property; @@ -535,7 +535,7 @@ GtkWidget * gdict_database_chooser_new_with_context (GdictContext *context) { g_return_val_if_fail (GDICT_IS_CONTEXT (context), NULL); - + return g_object_new (GDICT_TYPE_DATABASE_CHOOSER, "context", context, NULL); @@ -555,7 +555,7 @@ GdictContext * gdict_database_chooser_get_context (GdictDatabaseChooser *chooser) { g_return_val_if_fail (GDICT_IS_DATABASE_CHOOSER (chooser), NULL); - + return chooser->priv->context; } @@ -668,14 +668,14 @@ gdict_database_chooser_has_database (GdictDatabaseChooser *chooser, gtk_tree_model_get (GTK_TREE_MODEL (priv->store), &iter, DB_COLUMN_NAME, &db_name, -1); - + if (strcmp (db_name, database) == 0) { g_free (db_name); retval = TRUE; break; } - + g_free (db_name); } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (priv->store), &iter)); @@ -754,7 +754,7 @@ database_found_cb (GdictContext *context, GDICT_NOTE (CHOOSER, "DATABASE: `%s' (`%s')", name, full_name); - + gtk_list_store_append (priv->store, &iter); gtk_list_store_set (priv->store, &iter, DB_COLUMN_TYPE, DATABASE_NAME, @@ -793,7 +793,7 @@ gdict_database_chooser_refresh (GdictDatabaseChooser *chooser) { GdictDatabaseChooserPrivate *priv; GError *db_error; - + g_return_if_fail (GDICT_IS_DATABASE_CHOOSER (chooser)); priv = chooser->priv; @@ -879,7 +879,7 @@ typedef struct { gchar *db_name; GdictDatabaseChooser *chooser; - + guint found : 1; guint do_select : 1; guint do_activate : 1; @@ -1090,7 +1090,7 @@ gdict_database_chooser_get_current_database (GdictDatabaseChooser *chooser) gchar *retval = NULL; g_return_val_if_fail (GDICT_IS_DATABASE_CHOOSER (chooser), NULL); - + priv = chooser->priv; selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview)); @@ -1098,7 +1098,7 @@ gdict_database_chooser_get_current_database (GdictDatabaseChooser *chooser) return NULL; gtk_tree_model_get (model, &iter, DB_COLUMN_NAME, &retval, -1); - + g_free (priv->current_db); priv->current_db = g_strdup (retval); diff --git a/mate-dictionary/libgdict/gdict-database-chooser.h b/mate-dictionary/libgdict/gdict-database-chooser.h index c1d7316f..d5139942 100644 --- a/mate-dictionary/libgdict/gdict-database-chooser.h +++ b/mate-dictionary/libgdict/gdict-database-chooser.h @@ -45,7 +45,7 @@ struct _GdictDatabaseChooser { /*< private >*/ GtkBox parent_instance; - + GdictDatabaseChooserPrivate *priv; }; diff --git a/mate-dictionary/libgdict/gdict-source-chooser.c b/mate-dictionary/libgdict/gdict-source-chooser.c index 1579cc19..dd4f1f59 100644 --- a/mate-dictionary/libgdict/gdict-source-chooser.c +++ b/mate-dictionary/libgdict/gdict-source-chooser.c @@ -465,7 +465,7 @@ gdict_source_chooser_set_loader (GdictSourceChooser *chooser, /** * gdict_source_chooser_get_loader: * @chooser: a #GdictSourceChooser - * + * * Retrieves the #GdictSourceLoader used by @chooser. * * Return value: a #GdictSourceLoader or %NULL is none is set @@ -484,7 +484,7 @@ typedef struct { gchar *source_name; GdictSourceChooser *chooser; - + guint found : 1; guint do_select : 1; guint do_activate : 1; @@ -706,7 +706,7 @@ gdict_source_chooser_get_current_source (GdictSourceChooser *chooser) gchar *retval = NULL; g_return_val_if_fail (GDICT_IS_SOURCE_CHOOSER (chooser), NULL); - + priv = chooser->priv; selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview)); @@ -714,7 +714,7 @@ gdict_source_chooser_get_current_source (GdictSourceChooser *chooser) return NULL; gtk_tree_model_get (model, &iter, SOURCE_NAME, &retval, -1); - + g_free (priv->current_source); priv->current_source = g_strdup (retval); diff --git a/mate-dictionary/libgdict/gdict-strategy-chooser.c b/mate-dictionary/libgdict/gdict-strategy-chooser.c index a3a28112..56d1de4c 100644 --- a/mate-dictionary/libgdict/gdict-strategy-chooser.c +++ b/mate-dictionary/libgdict/gdict-strategy-chooser.c @@ -53,7 +53,7 @@ struct _GdictStrategyChooserPrivate GtkWidget *clear_button; GtkWidget *refresh_button; GtkWidget *buttons_box; - + GdictContext *context; gint results; @@ -88,7 +88,7 @@ enum enum { PROP_0, - + PROP_CONTEXT, PROP_COUNT }; @@ -112,25 +112,25 @@ set_gdict_context (GdictStrategyChooser *chooser, GdictContext *context) { GdictStrategyChooserPrivate *priv; - + g_assert (GDICT_IS_STRATEGY_CHOOSER (chooser)); priv = chooser->priv; - + if (priv->context) { if (priv->start_id) { GDICT_NOTE (CHOOSER, "Removing old context handlers"); - + g_signal_handler_disconnect (priv->context, priv->start_id); g_signal_handler_disconnect (priv->context, priv->match_id); g_signal_handler_disconnect (priv->context, priv->end_id); - + priv->start_id = 0; priv->end_id = 0; priv->match_id = 0; } - + if (priv->error_id) { g_signal_handler_disconnect (priv->context, priv->error_id); @@ -139,9 +139,9 @@ set_gdict_context (GdictStrategyChooser *chooser, } GDICT_NOTE (CHOOSER, "Removing old context"); - + g_object_unref (G_OBJECT (priv->context)); - + priv->context = NULL; priv->results = -1; } @@ -157,7 +157,7 @@ set_gdict_context (GdictStrategyChooser *chooser, } GDICT_NOTE (CHOOSER, "Setting new context"); - + priv->context = g_object_ref (context); priv->results = 0; } @@ -203,7 +203,7 @@ gdict_strategy_chooser_set_property (GObject *gobject, GParamSpec *pspec) { GdictStrategyChooser *chooser = GDICT_STRATEGY_CHOOSER (gobject); - + switch (prop_id) { case PROP_CONTEXT: @@ -222,7 +222,7 @@ gdict_strategy_chooser_get_property (GObject *gobject, GParamSpec *pspec) { GdictStrategyChooser *chooser = GDICT_STRATEGY_CHOOSER (gobject); - + switch (prop_id) { case PROP_CONTEXT: @@ -379,13 +379,13 @@ static void gdict_strategy_chooser_class_init (GdictStrategyChooserClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - + gobject_class->finalize = gdict_strategy_chooser_finalize; gobject_class->dispose = gdict_strategy_chooser_dispose; gobject_class->set_property = gdict_strategy_chooser_set_property; gobject_class->get_property = gdict_strategy_chooser_get_property; gobject_class->constructor = gdict_strategy_chooser_constructor; - + /** * GdictStrategyChooser:context: * @@ -477,7 +477,7 @@ GtkWidget * gdict_strategy_chooser_new_with_context (GdictContext *context) { g_return_val_if_fail (GDICT_IS_CONTEXT (context), NULL); - + return g_object_new (GDICT_TYPE_STRATEGY_CHOOSER, "context", context, NULL); @@ -497,7 +497,7 @@ GdictContext * gdict_strategy_chooser_get_context (GdictStrategyChooser *chooser) { g_return_val_if_fail (GDICT_IS_STRATEGY_CHOOSER (chooser), NULL); - + return chooser->priv->context; } @@ -611,7 +611,7 @@ gdict_strategy_chooser_has_strategy (GdictStrategyChooser *chooser, gtk_tree_model_get (GTK_TREE_MODEL (priv->store), &iter, STRAT_COLUMN_NAME, &strat_name, -1); - + if (strcmp (strat_name, strategy) == 0) { retval = TRUE; @@ -735,7 +735,7 @@ gdict_strategy_chooser_refresh (GdictStrategyChooser *chooser) { GdictStrategyChooserPrivate *priv; GError *db_error; - + g_return_if_fail (GDICT_IS_STRATEGY_CHOOSER (chooser)); priv = chooser->priv; @@ -821,7 +821,7 @@ typedef struct { gchar *strat_name; GdictStrategyChooser *chooser; - + guint found : 1; guint do_select : 1; guint do_activate : 1; @@ -1035,7 +1035,7 @@ gdict_strategy_chooser_get_current_strategy (GdictStrategyChooser *chooser) gchar *retval = NULL; g_return_val_if_fail (GDICT_IS_STRATEGY_CHOOSER (chooser), NULL); - + priv = chooser->priv; selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview)); @@ -1043,7 +1043,7 @@ gdict_strategy_chooser_get_current_strategy (GdictStrategyChooser *chooser) return NULL; gtk_tree_model_get (model, &iter, STRAT_COLUMN_NAME, &retval, -1); - + g_free (priv->current_strat); priv->current_strat = g_strdup (retval); diff --git a/mate-dictionary/libgdict/gdict-strategy-chooser.h b/mate-dictionary/libgdict/gdict-strategy-chooser.h index 522a9b44..a491227d 100644 --- a/mate-dictionary/libgdict/gdict-strategy-chooser.h +++ b/mate-dictionary/libgdict/gdict-strategy-chooser.h @@ -44,7 +44,7 @@ typedef struct _GdictStrategyChooserClass GdictStrategyChooserClass; struct _GdictStrategyChooser { GtkBox parent_instance; - + GdictStrategyChooserPrivate *priv; }; @@ -55,7 +55,7 @@ struct _GdictStrategyChooserClass void (*strategy_activated) (GdictStrategyChooser *chooser, const gchar *name, const gchar *description); - + void (*_gdict_padding1) (void); void (*_gdict_padding2) (void); void (*_gdict_padding3) (void); diff --git a/mate-dictionary/libgdict/gdict-utils.c b/mate-dictionary/libgdict/gdict-utils.c index c6f70781..2a463f74 100644 --- a/mate-dictionary/libgdict/gdict-utils.c +++ b/mate-dictionary/libgdict/gdict-utils.c @@ -158,7 +158,7 @@ gdict_get_option_group (void) _("Show GDict Options"), NULL, NULL); - + g_option_group_set_parse_hooks (group, pre_parse_hook, post_parse_hook); g_option_group_add_entries (group, gdict_args); g_option_group_set_translation_domain (group, GETTEXT_PACKAGE); @@ -188,7 +188,7 @@ gdict_debug_init (gint *argc, option_context = g_option_context_new (NULL); g_option_context_set_ignore_unknown_options (option_context, TRUE); - g_option_context_set_help_enabled (option_context, FALSE); + g_option_context_set_help_enabled (option_context, FALSE); gdict_group = gdict_get_option_group (); g_option_context_set_main_group (option_context, gdict_group); @@ -237,7 +237,7 @@ _gdict_has_ipv6 (void) if (s != -1) { close(s); - + return TRUE; } #endif @@ -252,23 +252,23 @@ show_error_dialog (GtkWindow *parent, const gchar *detail) { GtkWidget *dialog; - + dialog = gtk_message_dialog_new (parent, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", message); gtk_window_set_title (GTK_WINDOW (dialog), ""); - + if (detail) gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", detail); - + if (parent && gtk_window_get_group (parent)) gtk_window_group_add_window (gtk_window_get_group (parent), GTK_WINDOW (dialog)); - + gtk_dialog_run (GTK_DIALOG (dialog)); - + gtk_widget_destroy (dialog); } @@ -277,7 +277,7 @@ static GtkWindow * get_toplevel_window (GtkWidget *widget) { GtkWidget *toplevel; - + toplevel = gtk_widget_get_toplevel (widget); if (!gtk_widget_is_toplevel (toplevel)) return NULL; @@ -302,7 +302,7 @@ _gdict_show_error_dialog (GtkWidget *widget, { g_return_if_fail (GTK_IS_WIDGET (widget)); g_return_if_fail (title != NULL); - + show_error_dialog (get_toplevel_window (widget), title, detail); } @@ -326,8 +326,8 @@ _gdict_show_gerror_dialog (GtkWidget *widget, g_return_if_fail (GTK_IS_WIDGET (widget)); g_return_if_fail (title != NULL); g_return_if_fail (error != NULL); - + show_error_dialog (get_toplevel_window (widget), title, error->message); - + g_error_free (error); } diff --git a/mate-dictionary/libgdict/gdict-utils.h b/mate-dictionary/libgdict/gdict-utils.h index c7076e4d..c1ff6ab1 100644 --- a/mate-dictionary/libgdict/gdict-utils.h +++ b/mate-dictionary/libgdict/gdict-utils.h @@ -40,7 +40,7 @@ typedef enum { /* Status codes as defined by RFC 2229 */ typedef enum { GDICT_STATUS_INVALID = 0, - + GDICT_STATUS_N_DATABASES_PRESENT = 110, GDICT_STATUS_N_STRATEGIES_PRESENT = 111, GDICT_STATUS_DATABASE_INFO = 112, diff --git a/mate-dictionary/src/gdict-aligned-window.c b/mate-dictionary/src/gdict-aligned-window.c index a9881cd6..5ddefde2 100644 --- a/mate-dictionary/src/gdict-aligned-window.c +++ b/mate-dictionary/src/gdict-aligned-window.c @@ -6,14 +6,14 @@ * modify it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU Library General Public License - * along with this program; if not, write to the Free Software + * You should have received a copy of the GNU Library General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * Ported from Seth Nickell's Python class: @@ -38,14 +38,14 @@ struct _GdictAlignedWindowPrivate { GtkWidget *align_widget; - + guint motion_id; }; enum { PROP_0, - + PROP_ALIGN_WIDGET }; @@ -76,21 +76,21 @@ gdict_aligned_window_class_init (GdictAlignedWindowClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - + gobject_class->set_property = gdict_aligned_window_set_property; gobject_class->get_property = gdict_aligned_window_get_property; gobject_class->finalize = gdict_aligned_window_finalize; - + widget_class->realize = gdict_aligned_window_realize; widget_class->show = gdict_aligned_window_show; - + g_object_class_install_property (gobject_class, PROP_ALIGN_WIDGET, g_param_spec_object ("align-widget", "Align Widget", "The widget the window should align to", GTK_TYPE_WIDGET, G_PARAM_READWRITE)); - + g_type_class_add_private (klass, sizeof (GdictAlignedWindowPrivate)); } @@ -99,12 +99,12 @@ gdict_aligned_window_init (GdictAlignedWindow *aligned_window) { GdictAlignedWindowPrivate *priv = GDICT_ALIGNED_WINDOW_GET_PRIVATE (aligned_window); GtkWindow *window = GTK_WINDOW (aligned_window); - + aligned_window->priv = priv; - + priv->align_widget = NULL; priv->motion_id = 0; - + /* set window properties */ #if 0 gtk_window_set_modal (window, TRUE); @@ -120,7 +120,7 @@ gdict_aligned_window_get_property (GObject *object, GParamSpec *pspec) { GdictAlignedWindow *aligned_window = GDICT_ALIGNED_WINDOW (object); - + switch (prop_id) { case PROP_ALIGN_WIDGET: @@ -139,7 +139,7 @@ gdict_aligned_window_set_property (GObject *object, GParamSpec *pspec) { GdictAlignedWindow *aligned_window = GDICT_ALIGNED_WINDOW (object); - + switch (prop_id) { case PROP_ALIGN_WIDGET: @@ -185,7 +185,7 @@ gdict_aligned_window_position (GdictAlignedWindow *window) /* make sure the align_widget is realized before we do anything */ gtk_widget_realize (align_widget); - + /* get the positional and dimensional attributes of the align widget */ gdk_window_get_origin (gdk_window, &entry_x, @@ -197,22 +197,22 @@ gdict_aligned_window_position (GdictAlignedWindow *window) else { x = entry_x + entry_width - our_width - 1; - + gravity = GDK_GRAVITY_NORTH_EAST; } - + if (entry_y + entry_height + our_height < HeightOfScreen (gdk_x11_screen_get_xscreen (gdk_screen_get_default ()))) y = entry_y + entry_height - 1; else { y = entry_y - our_height + 1; - + if (gravity == GDK_GRAVITY_NORTH_EAST) gravity = GDK_GRAVITY_SOUTH_EAST; else gravity = GDK_GRAVITY_SOUTH_WEST; } - + gtk_window_set_gravity (GTK_WINDOW (window), gravity); gtk_window_move (GTK_WINDOW (window), x, y); } @@ -229,7 +229,7 @@ static void gdict_aligned_window_show (GtkWidget *widget) { gdict_aligned_window_position (GDICT_ALIGNED_WINDOW (widget)); - + GTK_WIDGET_CLASS (gdict_aligned_window_parent_class)->show (widget); } @@ -248,7 +248,7 @@ gdict_aligned_window_motion_notify_cb (GtkWidget *widget, GdkRectangle rect; gtk_widget_get_allocation (GTK_WIDGET (aligned_window), &alloc); - + rect.x = 0; rect.y = 0; rect.width = alloc.width; @@ -257,7 +257,7 @@ gdict_aligned_window_motion_notify_cb (GtkWidget *widget, gdk_window_invalidate_rect (gtk_widget_get_window (GTK_WIDGET (aligned_window)), &rect, FALSE); - + return FALSE; } @@ -294,24 +294,24 @@ gdict_aligned_window_set_widget (GdictAlignedWindow *aligned_window, GtkWidget *align_widget) { GdictAlignedWindowPrivate *priv; - + g_return_if_fail (GDICT_IS_ALIGNED_WINDOW (aligned_window)); g_return_if_fail (GTK_IS_WIDGET (align_widget)); -#if 0 +#if 0 if (GTK_WIDGET_NO_WINDOW (align_widget)) { g_warning ("Attempting to set a widget of class '%s' as the " "align widget, but widgets of this class does not " "have a GdkWindow.", g_type_name (G_OBJECT_TYPE (align_widget))); - + return; } #endif priv = GDICT_ALIGNED_WINDOW_GET_PRIVATE (aligned_window); - + if (priv->align_widget) { g_signal_handler_disconnect (priv->align_widget, priv->motion_id); @@ -336,6 +336,6 @@ GtkWidget * gdict_aligned_window_get_widget (GdictAlignedWindow *aligned_window) { g_return_val_if_fail (GDICT_IS_ALIGNED_WINDOW (aligned_window), NULL); - + return aligned_window->priv->align_widget; } diff --git a/mate-dictionary/src/gdict-aligned-window.h b/mate-dictionary/src/gdict-aligned-window.h index b81bcf55..d1f4f67e 100644 --- a/mate-dictionary/src/gdict-aligned-window.h +++ b/mate-dictionary/src/gdict-aligned-window.h @@ -6,14 +6,14 @@ * modify it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU Library General Public License - * along with this program; if not, write to the Free Software + * You should have received a copy of the GNU Library General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * Ported from Seth Nickell's Python class: @@ -42,7 +42,7 @@ struct _GdictAlignedWindow { /*< private >*/ GtkWindow parent_instance; - + GdictAlignedWindowPrivate *priv; }; @@ -50,7 +50,7 @@ struct _GdictAlignedWindowClass { /*< private >*/ GtkWindowClass parent_class; - + void (*_gdict_reserved1) (void); void (*_gdict_reserved2) (void); void (*_gdict_reserved3) (void); diff --git a/mate-dictionary/src/gdict-app.c b/mate-dictionary/src/gdict-app.c index a8b79b38..fe5e5b32 100644 --- a/mate-dictionary/src/gdict-app.c +++ b/mate-dictionary/src/gdict-app.c @@ -55,12 +55,12 @@ static void gdict_app_finalize (GObject *object) { GdictApp *app = GDICT_APP (object); - + if (app->loader) g_object_unref (app->loader); - + app->current_window = NULL; - + g_slist_free_full (app->windows, (GDestroyNotify) gtk_widget_destroy); g_slist_free_full (app->lookup_words, g_free); g_slist_free_full (app->match_words, g_free); @@ -75,7 +75,7 @@ static void gdict_app_class_init (GdictAppClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - + gobject_class->finalize = gdict_app_finalize; } @@ -92,16 +92,16 @@ gdict_window_destroy_cb (GtkWidget *widget, { GdictWindow *window = GDICT_WINDOW (widget); GdictApp *app = GDICT_APP (user_data); - + g_assert (GDICT_IS_APP (app)); app->windows = g_slist_remove (app->windows, window); - + if (window == app->current_window) app->current_window = app->windows ? app->windows->data : NULL; - + if (app->windows == NULL) - gtk_main_quit (); + gtk_main_quit (); } static void @@ -110,7 +110,7 @@ gdict_window_created_cb (GdictWindow *parent, gpointer user_data) { GdictApp *app = GDICT_APP (user_data); - + /* this might seem convoluted - but it's necessary, since I don't want * GdictWindow to know about the GdictApp singleton. every time a new * window is created by a GdictWindow, it will register its "child window" @@ -125,7 +125,7 @@ gdict_window_created_cb (GdictWindow *parent, if (gtk_window_get_group (GTK_WINDOW (parent))) gtk_window_group_add_window (gtk_window_get_group (GTK_WINDOW (parent)), GTK_WINDOW (new_window)); - + app->windows = g_slist_prepend (app->windows, new_window); app->current_window = new_window; } @@ -147,15 +147,15 @@ gdict_create_window (GdictApp *app) G_CALLBACK (gdict_window_created_cb), app); g_signal_connect (window, "destroy", G_CALLBACK (gdict_window_destroy_cb), app); - + app->windows = g_slist_prepend (app->windows, window); app->current_window = GDICT_WINDOW (window); - + gtk_widget_show (window); return; } - + for (l = singleton->lookup_words; l != NULL; l = l->next) { gchar *word = l->data; @@ -165,15 +165,15 @@ gdict_create_window (GdictApp *app) singleton->loader, singleton->source_name, word); - + g_signal_connect (window, "created", G_CALLBACK (gdict_window_created_cb), app); g_signal_connect (window, "destroy", G_CALLBACK (gdict_window_destroy_cb), app); - + app->windows = g_slist_prepend (app->windows, window); app->current_window = GDICT_WINDOW (window); - + gtk_widget_show (window); } @@ -186,12 +186,12 @@ gdict_create_window (GdictApp *app) singleton->loader, singleton->source_name, word); - + g_signal_connect (window, "created", G_CALLBACK (gdict_window_created_cb), app); g_signal_connect (window, "destroy", G_CALLBACK (gdict_window_destroy_cb), app); - + app->windows = g_slist_prepend (app->windows, window); app->current_window = GDICT_WINDOW (window); @@ -244,7 +244,7 @@ gdict_look_up_word_and_quit (GdictApp *app) GdictSource *source; GdictContext *context; GSList *l; - + if (!app->lookup_words) { g_print (_("See mate-dictionary --help for usage\n")); @@ -336,15 +336,15 @@ gdict_init (int *argc, char ***argv) N_("Words to look up"), N_("word") }, { NULL }, }; - - g_assert (singleton == NULL); - + + g_assert (singleton == NULL); + singleton = GDICT_APP (g_object_new (GDICT_TYPE_APP, NULL)); g_assert (GDICT_IS_APP (singleton)); - + /* create the new option context */ context = g_option_context_new (_(" - Look up words in dictionaries")); - + g_option_context_set_translation_domain (context, GETTEXT_PACKAGE); g_option_context_add_main_entries (context, gdict_app_goptions, GETTEXT_PACKAGE); g_option_context_add_group (context, gdict_get_option_group ()); @@ -360,10 +360,10 @@ gdict_init (int *argc, char ***argv) exit (1); } - + g_set_application_name (_("Dictionary")); gtk_window_set_default_icon_name ("accessories-dictionary"); - + if (!gdict_create_data_dir ()) { gdict_cleanup (); @@ -373,9 +373,9 @@ gdict_init (int *argc, char ***argv) singleton->settings = g_settings_new ("org.mate.dictionary"); - /* add user's path for fetching dictionary sources */ + /* add user's path for fetching dictionary sources */ singleton->loader = gdict_source_loader_new (); - loader_path = gdict_get_data_dir (); + loader_path = gdict_get_data_dir (); gdict_source_loader_add_search_path (singleton->loader, loader_path); g_free (loader_path); @@ -401,7 +401,7 @@ gdict_init (int *argc, char ***argv) if (database) singleton->database = g_strdup (database); - + if (source_name) singleton->source_name = g_strdup (source_name); @@ -417,12 +417,12 @@ gdict_main (void) g_warning ("You must initialize GdictApp using gdict_init()\n"); return; } - + if (!singleton->no_window) gdict_create_window (singleton); else gdict_look_up_word_and_quit (singleton); - + gtk_main (); } diff --git a/mate-dictionary/src/gdict-app.h b/mate-dictionary/src/gdict-app.h index f91bc908..b0a6ae2d 100644 --- a/mate-dictionary/src/gdict-app.h +++ b/mate-dictionary/src/gdict-app.h @@ -48,15 +48,15 @@ struct _GdictApp GSList *lookup_words; GSList *match_words; gint remaining_words; - + gchar *database; gchar *source_name; gboolean no_window; - + GdictSourceLoader *loader; GdictWindow *current_window; - GSList *windows; + GSList *windows; }; diff --git a/mate-dictionary/src/gdict-applet.c b/mate-dictionary/src/gdict-applet.c index 11a3f85e..8dba6ec3 100644 --- a/mate-dictionary/src/gdict-applet.c +++ b/mate-dictionary/src/gdict-applet.c @@ -6,14 +6,14 @@ * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -52,17 +52,17 @@ struct _GdictAppletPrivate { guint size; GtkOrientation orient; - + GSettings *settings; GSettings *desktop_settings; gchar *database; gchar *strategy; - gchar *source_name; + gchar *source_name; gchar *print_font; gchar *defbox_font; - gchar *word; + gchar *word; GdictContext *context; guint lookup_start_id; guint lookup_end_id; @@ -112,9 +112,9 @@ static void set_atk_name_description (GtkWidget *widget, const char *name, const char *description) -{ +{ AtkObject *aobj; - + aobj = gtk_widget_get_accessible (widget); if (!GTK_IS_ACCESSIBLE (aobj)) return; @@ -137,7 +137,7 @@ set_window_default_size (GdictApplet *applet) if (!priv->window) return; - + widget = priv->window; defbox = priv->defbox; @@ -176,7 +176,7 @@ clear_cb (GtkWidget *widget, if (!priv->defbox) return; - + gdict_defbox_clear (GDICT_DEFBOX (priv->defbox)); } @@ -188,7 +188,7 @@ print_cb (GtkWidget *widget, if (!priv->defbox) return; - + gdict_show_print_dialog (GTK_WINDOW (priv->window), GDICT_DEFBOX (priv->defbox)); } @@ -202,7 +202,7 @@ save_cb (GtkWidget *widget, if (!priv->defbox) return; - + dialog = gtk_file_chooser_dialog_new (_("Save a Copy"), GTK_WINDOW (priv->window), GTK_FILE_CHOOSER_ACTION_SAVE, @@ -210,22 +210,22 @@ save_cb (GtkWidget *widget, "gtk-save", GTK_RESPONSE_ACCEPT, NULL); gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE); - + /* default to user's $HOME */ gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), g_get_home_dir ()); gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), _("Untitled document")); - + if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) { gchar *filename; gchar *text; gsize len; GError *write_error = NULL; - + filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); - + text = gdict_defbox_get_text (GDICT_DEFBOX (priv->defbox), &len); - + g_file_set_contents (filename, text, len, @@ -233,17 +233,17 @@ save_cb (GtkWidget *widget, if (write_error) { gchar *message; - + message = g_strdup_printf (_("Error while writing to '%s'"), filename); - + gdict_show_error_dialog (GTK_WINDOW (priv->window), message, write_error->message); - + g_error_free (write_error); g_free (message); } - + g_free (text); g_free (filename); } @@ -276,7 +276,7 @@ window_key_press_event_cb (GtkWidget *widget, gpointer user_data) { GdictApplet *applet = GDICT_APPLET (user_data); - + if (event->keyval == GDK_KEY_Escape) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (applet->priv->toggle), FALSE); @@ -318,7 +318,7 @@ gdict_applet_build_window (GdictApplet *applet) return; } - + window = gdict_aligned_window_new (priv->toggle); g_signal_connect (window, "key-press-event", G_CALLBACK (window_key_press_event_cb), @@ -337,11 +337,11 @@ gdict_applet_build_window (GdictApplet *applet) gtk_container_set_border_width (GTK_CONTAINER (vbox), 6); gtk_container_add (GTK_CONTAINER (frame), vbox); gtk_widget_show (vbox); - + priv->defbox = gdict_defbox_new (); if (priv->context) gdict_defbox_set_context (GDICT_DEFBOX (priv->defbox), priv->context); - + gtk_box_pack_start (GTK_BOX (vbox), priv->defbox, TRUE, TRUE, 0); gtk_widget_show (priv->defbox); gtk_widget_set_can_focus (priv->defbox, TRUE); @@ -352,7 +352,7 @@ gdict_applet_build_window (GdictApplet *applet) gtk_box_set_spacing (GTK_BOX (bbox), 6); gtk_box_pack_end (GTK_BOX (vbox), bbox, FALSE, FALSE, 0); gtk_widget_show (bbox); - + button = GTK_WIDGET (g_object_new (GTK_TYPE_BUTTON, "label", "gtk-clear", "use-stock", TRUE, @@ -363,7 +363,7 @@ gdict_applet_build_window (GdictApplet *applet) set_atk_name_description (button, _("Clear definition"), _("Clear the text of the definition")); - + g_signal_connect (button, "clicked", G_CALLBACK (clear_cb), applet); gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0); gtk_widget_show (button); @@ -378,7 +378,7 @@ gdict_applet_build_window (GdictApplet *applet) set_atk_name_description (button, _("Print definition"), _("Print the text of the definition")); - + g_signal_connect (button, "clicked", G_CALLBACK (print_cb), applet); gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0); gtk_widget_show (button); @@ -393,13 +393,13 @@ gdict_applet_build_window (GdictApplet *applet) set_atk_name_description (button, _("Save definition"), _("Save the text of the definition to a file")); - + g_signal_connect (button, "clicked", G_CALLBACK (save_cb), applet); gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0); gtk_widget_show (button); - + gtk_window_set_default (GTK_WINDOW (window), priv->defbox); - + priv->window = window; priv->is_window_showing = FALSE; } @@ -412,14 +412,14 @@ gdict_applet_icon_toggled_cb (GtkWidget *widget, if (!priv->window) gdict_applet_build_window (applet); - + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) { gtk_window_set_screen (GTK_WINDOW (priv->window), gtk_widget_get_screen (GTK_WIDGET (applet))); gtk_window_present (GTK_WINDOW (priv->window)); gtk_widget_grab_focus (priv->defbox); - + priv->is_window_showing = TRUE; } else @@ -429,7 +429,7 @@ gdict_applet_icon_toggled_cb (GtkWidget *widget, gtk_widget_grab_focus (priv->entry); gtk_widget_hide (priv->window); - + priv->is_window_showing = FALSE; } @@ -442,14 +442,14 @@ gdict_applet_entry_activate_cb (GtkWidget *widget, { GdictAppletPrivate *priv = applet->priv; gchar *text; - + text = gtk_editable_get_chars (GTK_EDITABLE (widget), 0, -1); if (!text) return; - + g_free (priv->word); priv->word = text; - + if (!priv->window) gdict_applet_build_window (applet); @@ -462,14 +462,14 @@ gdict_applet_entry_key_press_cb (GtkWidget *widget, gpointer user_data) { GdictAppletPrivate *priv = GDICT_APPLET (user_data)->priv; - + if (event->keyval == GDK_KEY_Escape) { if (priv->is_window_showing) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->toggle), FALSE); gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON (priv->toggle)); - + return TRUE; } } @@ -488,7 +488,7 @@ gdict_applet_icon_button_press_event_cb (GtkWidget *widget, GdictApplet *applet) { GdictAppletPrivate *priv = applet->priv; - + /* we don't want to block the applet's popup menu unless the * user is toggling the button */ @@ -518,12 +518,12 @@ gdict_applet_draw (GdictApplet *applet) if (priv->entry) text = gtk_editable_get_chars (GTK_EDITABLE (priv->entry), 0, -1); - + if (priv->box) gtk_widget_destroy (priv->box); box = gtk_box_new (priv->orient, 0); - + gtk_container_add (GTK_CONTAINER (applet), box); gtk_widget_show (box); @@ -533,7 +533,7 @@ gdict_applet_draw (GdictApplet *applet) set_atk_name_description (priv->toggle, _("Toggle dictionary window"), _("Show or hide the definition window")); - + gtk_button_set_relief (GTK_BUTTON (priv->toggle), GTK_RELIEF_NONE); g_signal_connect (priv->toggle, "toggled", @@ -553,7 +553,7 @@ gdict_applet_draw (GdictApplet *applet) if (priv->icon) { GdkPixbuf *scaled; - + priv->image = gtk_image_new (); gtk_image_set_pixel_size (GTK_IMAGE (priv->image), priv->size - 10); @@ -561,12 +561,12 @@ gdict_applet_draw (GdictApplet *applet) priv->size - 5, priv->size - 5, GDK_INTERP_BILINEAR); - + gtk_image_set_from_pixbuf (GTK_IMAGE (priv->image), scaled); g_object_unref (scaled); - + gtk_box_pack_start (GTK_BOX (hbox), priv->image, FALSE, FALSE, 0); - + gtk_widget_show (priv->image); } else @@ -576,7 +576,7 @@ gdict_applet_draw (GdictApplet *applet) gtk_image_set_pixel_size (GTK_IMAGE (priv->image), priv->size - 10); gtk_image_set_from_icon_name (GTK_IMAGE (priv->image), "image-missing", -1); - + gtk_box_pack_start (GTK_BOX (hbox), priv->image, FALSE, FALSE, 0); gtk_widget_show (priv->image); } @@ -587,7 +587,7 @@ gdict_applet_draw (GdictApplet *applet) set_atk_name_description (priv->entry, _("Dictionary entry"), _("Look up words in dictionaries")); - + gtk_editable_set_editable (GTK_EDITABLE (priv->entry), TRUE); gtk_entry_set_width_chars (GTK_ENTRY (priv->entry), 12); g_signal_connect (priv->entry, "activate", @@ -608,13 +608,13 @@ gdict_applet_draw (GdictApplet *applet) g_free (text); } - + priv->box = box; #if 0 gtk_widget_grab_focus (priv->entry); #endif - + gtk_widget_show_all (GTK_WIDGET (applet)); return FALSE; @@ -640,7 +640,7 @@ gdict_applet_lookup_start_cb (GdictContext *context, if (!priv->is_window_showing) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->toggle), TRUE); - + gtk_window_present (GTK_WINDOW (priv->window)); gtk_widget_grab_focus (priv->defbox); @@ -674,17 +674,17 @@ gdict_applet_cmd_lookup (GtkAction *action, { GdictAppletPrivate *priv = applet->priv; gchar *text = NULL;; - + text = gtk_editable_get_chars (GTK_EDITABLE (priv->entry), 0, -1); if (!text) return; - + g_free (priv->word); priv->word = text; - + if (!priv->window) gdict_applet_build_window (applet); - + gdict_defbox_lookup (GDICT_DEFBOX (priv->defbox), priv->word); } @@ -734,7 +734,7 @@ gdict_applet_cmd_help (GtkAction *action, gtk_show_uri_on_window (NULL, "help:mate-dictionary/mate-dictionary-applet", gtk_get_current_event_time (), &err); - + if (err) { gdict_show_error_dialog (NULL, @@ -751,7 +751,7 @@ gdict_applet_change_orient (MatePanelApplet *applet, GdictAppletPrivate *priv = GDICT_APPLET (applet)->priv; guint new_size; GtkAllocation allocation; - + gtk_widget_get_allocation (GTK_WIDGET (applet), &allocation); switch (orient) { @@ -766,12 +766,12 @@ gdict_applet_change_orient (MatePanelApplet *applet, new_size = allocation.height; break; } - + if (new_size != priv->size) priv->size = new_size; - + gdict_applet_queue_draw (GDICT_APPLET (applet)); - + if (MATE_PANEL_APPLET_CLASS (gdict_applet_parent_class)->change_orient) MATE_PANEL_APPLET_CLASS (gdict_applet_parent_class)->change_orient (applet, orient); @@ -784,12 +784,12 @@ gdict_applet_size_allocate (GtkWidget *widget, GdictApplet *applet = GDICT_APPLET (widget); GdictAppletPrivate *priv = applet->priv; guint new_size; - + if (priv->orient == GTK_ORIENTATION_HORIZONTAL) new_size = allocation->height; else new_size = allocation->width; - + if (priv->size != new_size) { priv->size = new_size; @@ -805,7 +805,7 @@ gdict_applet_size_allocate (GtkWidget *widget, priv->size - 5, priv->size - 5, GDK_INTERP_BILINEAR); - + gtk_image_set_from_pixbuf (GTK_IMAGE (priv->image), scaled); g_object_unref (scaled); } @@ -833,7 +833,7 @@ gdict_applet_set_database (GdictApplet *applet, const gchar *database) { GdictAppletPrivate *priv = applet->priv; - + g_free (priv->database); if (database != NULL && *database != '\0') @@ -851,7 +851,7 @@ gdict_applet_set_strategy (GdictApplet *applet, const gchar *strategy) { GdictAppletPrivate *priv = applet->priv; - + g_free (priv->strategy); if (strategy != NULL && *strategy != '\0') @@ -876,42 +876,42 @@ get_context_from_loader (GdictApplet *applet) if (!source) { gchar *detail; - + detail = g_strdup_printf (_("No dictionary source available with name '%s'"), priv->source_name); gdict_show_error_dialog (NULL, _("Unable to find dictionary source"), detail); - + g_free (detail); return NULL; } - + gdict_applet_set_database (applet, gdict_source_get_database (source)); gdict_applet_set_strategy (applet, gdict_source_get_strategy (source)); - + retval = gdict_source_get_context (source); if (!retval) { gchar *detail; - + detail = g_strdup_printf (_("No context available for source '%s'"), gdict_source_get_description (source)); - + gdict_show_error_dialog (NULL, _("Unable to create a context"), detail); - + g_free (detail); g_object_unref (source); - + return NULL; } - + g_object_unref (source); - + return retval; } @@ -954,17 +954,17 @@ gdict_applet_set_context (GdictApplet *applet, GdictContext *context) { GdictAppletPrivate *priv = applet->priv; - + if (priv->context) { g_signal_handler_disconnect (priv->context, priv->lookup_start_id); g_signal_handler_disconnect (priv->context, priv->lookup_end_id); g_signal_handler_disconnect (priv->context, priv->error_id); - + priv->lookup_start_id = 0; priv->lookup_end_id = 0; priv->error_id = 0; - + g_object_unref (priv->context); priv->context = NULL; } @@ -974,7 +974,7 @@ gdict_applet_set_context (GdictApplet *applet, if (!context) return; - + /* attach our callbacks */ priv->lookup_start_id = g_signal_connect (context, "lookup-start", G_CALLBACK (gdict_applet_lookup_start_cb), @@ -985,7 +985,7 @@ gdict_applet_set_context (GdictApplet *applet, priv->error_id = g_signal_connect (context, "error", G_CALLBACK (gdict_applet_error_cb), applet); - + priv->context = context; } @@ -1003,7 +1003,7 @@ gdict_applet_set_source_name (GdictApplet *applet, else priv->source_name = g_settings_get_string (priv->settings, GDICT_SETTINGS_SOURCE_KEY); - + context = get_context_from_loader (applet); gdict_applet_set_context (applet, context); } @@ -1073,18 +1073,18 @@ gdict_applet_finalize (GObject *object) g_object_unref (priv->context); } - + if (priv->loader) g_object_unref (priv->loader); - + if (priv->icon) g_object_unref (priv->icon); - + g_free (priv->source_name); g_free (priv->print_font); g_free (priv->defbox_font); g_free (priv->word); - + G_OBJECT_CLASS (gdict_applet_parent_class)->finalize (object); } @@ -1094,14 +1094,14 @@ gdict_applet_class_init (GdictAppletClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); MatePanelAppletClass *applet_class = MATE_PANEL_APPLET_CLASS (klass); - + gobject_class->finalize = gdict_applet_finalize; - + widget_class->size_allocate = gdict_applet_size_allocate; widget_class->style_set = gdict_applet_style_set; - + applet_class->change_orient = gdict_applet_change_orient; - + g_type_class_add_private (gobject_class, sizeof (GdictAppletPrivate)); } @@ -1113,7 +1113,7 @@ gdict_applet_init (GdictApplet *applet) priv = GDICT_APPLET_GET_PRIVATE (applet); applet->priv = priv; - + if (!priv->loader) priv->loader = gdict_source_loader_new (); @@ -1121,9 +1121,9 @@ gdict_applet_init (GdictApplet *applet) data_dir = gdict_get_data_dir (); gdict_source_loader_add_search_path (priv->loader, data_dir); g_free (data_dir); - + gtk_window_set_default_icon_name ("accessories-dictionary"); - + mate_panel_applet_set_flags (MATE_PANEL_APPLET (applet), MATE_PANEL_APPLET_EXPAND_MINOR); @@ -1158,7 +1158,7 @@ gdict_applet_init (GdictApplet *applet) 48, 0, NULL); - + /* force first draw */ gdict_applet_draw (applet); @@ -1221,7 +1221,7 @@ gdict_applet_factory (MatePanelApplet *applet, /* set the menu items insensitive */ gdict_applet_set_menu_items_sensitive (dictionary_applet, FALSE); - + retval = TRUE; } diff --git a/mate-dictionary/src/gdict-applet.h b/mate-dictionary/src/gdict-applet.h index c4776488..cf9396ed 100644 --- a/mate-dictionary/src/gdict-applet.h +++ b/mate-dictionary/src/gdict-applet.h @@ -6,14 +6,14 @@ * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -37,8 +37,8 @@ typedef struct _GdictAppletPrivate GdictAppletPrivate; struct _GdictApplet { MatePanelApplet parent_instance; - - GdictAppletPrivate *priv; + + GdictAppletPrivate *priv; }; GType gdict_applet_get_type (void); diff --git a/mate-dictionary/src/gdict-common.c b/mate-dictionary/src/gdict-common.c index 1686a87e..7c0b3063 100644 --- a/mate-dictionary/src/gdict-common.c +++ b/mate-dictionary/src/gdict-common.c @@ -48,7 +48,7 @@ gdict_get_data_dir (void) "mate", "mate-dictionary", NULL); - + return retval; } @@ -57,7 +57,7 @@ gboolean gdict_create_data_dir (void) { gchar *data_dir_name; - + data_dir_name = gdict_get_data_dir (); if (g_mkdir_with_parents (data_dir_name, 0700) == -1) { @@ -68,7 +68,7 @@ gdict_create_data_dir (void) (g_file_test (data_dir_name, G_FILE_TEST_IS_REGULAR))) { gchar *backup = g_strdup_printf ("%s.pre-2-14", data_dir_name); - + if (g_rename (data_dir_name, backup) == -1) { GtkWidget *error_dialog; @@ -81,9 +81,9 @@ gdict_create_data_dir (void) data_dir_name, backup, g_strerror (errno)); - + gtk_dialog_run (GTK_DIALOG (error_dialog)); - + gtk_widget_destroy (error_dialog); g_free (backup); g_free (data_dir_name); @@ -92,11 +92,11 @@ gdict_create_data_dir (void) } g_free (backup); - + if (g_mkdir_with_parents (data_dir_name, 0700) == -1) { GtkWidget *error_dialog; - + error_dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, @@ -104,9 +104,9 @@ gdict_create_data_dir (void) _("Unable to create the data directory '%s': %s"), data_dir_name, g_strerror (errno)); - + gtk_dialog_run (GTK_DIALOG (error_dialog)); - + gtk_widget_destroy (error_dialog); g_free (data_dir_name); @@ -115,7 +115,7 @@ gdict_create_data_dir (void) goto success; } - + if (errno != EEXIST) { GtkWidget *error_dialog; @@ -127,9 +127,9 @@ gdict_create_data_dir (void) _("Unable to create the data directory '%s': %s"), data_dir_name, g_strerror (errno)); - + gtk_dialog_run (GTK_DIALOG (error_dialog)); - + gtk_widget_destroy (error_dialog); g_free (data_dir_name); @@ -150,26 +150,26 @@ gdict_show_error_dialog (GtkWindow *parent, const gchar *detail) { GtkWidget *dialog; - + g_return_if_fail ((parent == NULL) || (GTK_IS_WINDOW (parent))); g_return_if_fail (message != NULL); - + dialog = gtk_message_dialog_new (parent, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", message); gtk_window_set_title (GTK_WINDOW (dialog), ""); - + if (detail) gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", detail); - + if (parent && gtk_window_get_group (parent)) gtk_window_group_add_window (gtk_window_get_group (parent), GTK_WINDOW (dialog)); - + gtk_dialog_run (GTK_DIALOG (dialog)); - + gtk_widget_destroy (dialog); } @@ -181,9 +181,9 @@ gdict_show_gerror_dialog (GtkWindow *parent, g_return_if_fail ((parent == NULL) || (GTK_IS_WINDOW (parent))); g_return_if_fail (message != NULL); g_return_if_fail (error != NULL); - + gdict_show_error_dialog (parent, message, error->message); - + g_error_free (error); error = NULL; } diff --git a/mate-dictionary/src/gdict-pref-dialog.c b/mate-dictionary/src/gdict-pref-dialog.c index d6dbcab2..e94ffc44 100644 --- a/mate-dictionary/src/gdict-pref-dialog.c +++ b/mate-dictionary/src/gdict-pref-dialog.c @@ -56,7 +56,7 @@ enum SOURCES_ACTIVE_COLUMN = 0, SOURCES_NAME_COLUMN, SOURCES_DESCRIPTION_COLUMN, - + SOURCES_N_COLUMNS }; @@ -67,22 +67,22 @@ struct _GdictPrefDialog GtkBuilder *builder; GSettings *settings; - + gchar *active_source; GdictSourceLoader *loader; GtkListStore *sources_list; - + /* direct pointers to widgets */ GtkWidget *notebook; - + GtkWidget *sources_view; GtkWidget *sources_add; GtkWidget *sources_remove; GtkWidget *sources_edit; - + gchar *print_font; GtkWidget *font_button; - + GtkWidget *help_button; GtkWidget *close_button; }; @@ -111,21 +111,21 @@ select_active_source_name (GtkTreeModel *model, { GdictPrefDialog *dialog = GDICT_PREF_DIALOG (data); gboolean is_active; - + gtk_tree_model_get (model, iter, SOURCES_ACTIVE_COLUMN, &is_active, -1); if (is_active) { GtkTreeSelection *selection; - + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->sources_view)); - + gtk_tree_selection_select_iter (selection, iter); - + return TRUE; } - + return FALSE; } @@ -133,14 +133,14 @@ static void update_sources_view (GdictPrefDialog *dialog) { const GSList *sources, *l; - + gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->sources_view), NULL); - + gtk_list_store_clear (dialog->sources_list); - + /* force update of the sources list */ gdict_source_loader_update (dialog->loader); - + sources = gdict_source_loader_get_sources (dialog->loader); for (l = sources; l != NULL; l = l->next) { @@ -148,7 +148,7 @@ update_sources_view (GdictPrefDialog *dialog) GtkTreeIter iter; const gchar *name, *description; gboolean is_active = FALSE; - + name = gdict_source_get_name (source); description = gdict_source_get_description (source); if (!description) @@ -167,7 +167,7 @@ update_sources_view (GdictPrefDialog *dialog) gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->sources_view), GTK_TREE_MODEL (dialog->sources_list)); - + /* select the currently active source name */ gtk_tree_model_foreach (GTK_TREE_MODEL (dialog->sources_list), select_active_source_name, @@ -184,7 +184,7 @@ source_renderer_toggled_cb (GtkCellRendererToggle *renderer, gboolean res; gboolean is_active; gchar *name; - + treepath = gtk_tree_path_new_from_string (path); res = gtk_tree_model_get_iter (GTK_TREE_MODEL (dialog->sources_list), &iter, @@ -192,7 +192,7 @@ source_renderer_toggled_cb (GtkCellRendererToggle *renderer, if (!res) { gtk_tree_path_free (treepath); - + return; } @@ -210,7 +210,7 @@ source_renderer_toggled_cb (GtkCellRendererToggle *renderer, g_free (name); } - + gtk_tree_path_free (treepath); } @@ -228,14 +228,14 @@ sources_view_row_activated_cb (GtkTreeView *tree_view, model = gtk_tree_view_get_model (tree_view); if (!model) return; - + if (!gtk_tree_model_get_iter (model, &iter, tree_path)) return; - + gtk_tree_model_get (model, &iter, SOURCES_NAME_COLUMN, &source_name, -1); if (!source_name) return; - + edit_dialog = gdict_source_dialog_new (GTK_WINDOW (dialog), _("Edit Dictionary Source"), GDICT_SOURCE_DIALOG_EDIT, @@ -254,10 +254,10 @@ build_sources_view (GdictPrefDialog *dialog) { GtkTreeViewColumn *column; GtkCellRenderer *renderer; - + if (dialog->sources_list) return; - + dialog->sources_list = gtk_list_store_new (SOURCES_N_COLUMNS, G_TYPE_BOOLEAN, /* active */ G_TYPE_STRING, /* name */ @@ -265,13 +265,13 @@ build_sources_view (GdictPrefDialog *dialog) gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (dialog->sources_list), SOURCES_DESCRIPTION_COLUMN, GTK_SORT_ASCENDING); - + renderer = gtk_cell_renderer_toggle_new (); gtk_cell_renderer_toggle_set_radio (GTK_CELL_RENDERER_TOGGLE (renderer), TRUE); g_signal_connect (renderer, "toggled", G_CALLBACK (source_renderer_toggled_cb), dialog); - + column = gtk_tree_view_column_new_with_attributes ("active", renderer, "active", SOURCES_ACTIVE_COLUMN, @@ -284,7 +284,7 @@ build_sources_view (GdictPrefDialog *dialog) "text", SOURCES_DESCRIPTION_COLUMN, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (dialog->sources_view), column); - + gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (dialog->sources_view), FALSE); gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->sources_view), GTK_TREE_MODEL (dialog->sources_list)); @@ -299,7 +299,7 @@ source_add_clicked_cb (GtkWidget *widget, GdictPrefDialog *dialog) { GtkWidget *add_dialog; - + add_dialog = gdict_source_dialog_new (GTK_WINDOW (dialog), _("Add Dictionary Source"), GDICT_SOURCE_DIALOG_CREATE, @@ -322,26 +322,26 @@ source_remove_clicked_cb (GtkWidget *widget, GtkTreeIter iter; gboolean is_selected; gchar *name, *description; - + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->sources_view)); if (!selection) return; - + is_selected = gtk_tree_selection_get_selected (selection, &model, &iter); if (!is_selected) return; - + gtk_tree_model_get (model, &iter, SOURCES_NAME_COLUMN, &name, SOURCES_DESCRIPTION_COLUMN, &description, -1); - if (!name) + if (!name) return; else { GtkWidget *confirm_dialog; gint response; - + confirm_dialog = gtk_message_dialog_new (GTK_WINDOW (dialog), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, @@ -350,53 +350,53 @@ source_remove_clicked_cb (GtkWidget *widget, gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (confirm_dialog), _("This will permanently remove the " "dictionary source from the list.")); - + gtk_dialog_add_button (GTK_DIALOG (confirm_dialog), "gtk-cancel", GTK_RESPONSE_CANCEL); gtk_dialog_add_button (GTK_DIALOG (confirm_dialog), "gtk-remove", GTK_RESPONSE_OK); - + gtk_window_set_title (GTK_WINDOW (confirm_dialog), ""); - + response = gtk_dialog_run (GTK_DIALOG (confirm_dialog)); if (response == GTK_RESPONSE_CANCEL) { gtk_widget_destroy (confirm_dialog); - + goto out; } - + gtk_widget_destroy (confirm_dialog); } - + if (gdict_source_loader_remove_source (dialog->loader, name)) gtk_list_store_remove (GTK_LIST_STORE (model), &iter); else { GtkWidget *error_dialog; gchar *message; - + message = g_strdup_printf (_("Unable to remove source '%s'"), description); - + error_dialog = gtk_message_dialog_new (GTK_WINDOW (dialog), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", message); gtk_window_set_title (GTK_WINDOW (error_dialog), ""); - + gtk_dialog_run (GTK_DIALOG (error_dialog)); - + gtk_widget_destroy (error_dialog); } out: g_free (name); g_free (description); - + update_sources_view (dialog); } @@ -446,12 +446,12 @@ set_source_loader (GdictPrefDialog *dialog, { if (!dialog->sources_list) return; - + if (dialog->loader) g_object_unref (dialog->loader); - + dialog->loader = g_object_ref (loader); - + update_sources_view (dialog); } @@ -460,7 +460,7 @@ font_button_font_set_cb (GtkWidget *font_button, GdictPrefDialog *dialog) { gchar *font; - + font = gtk_font_chooser_get_font (GTK_FONT_CHOOSER (font_button)); if (!font || font[0] == '\0' || g_strcmp0 (dialog->print_font, font) == 0) @@ -483,7 +483,7 @@ response_cb (GtkDialog *dialog, gpointer user_data) { GError *err = NULL; - + switch (response_id) { case GTK_RESPONSE_HELP: @@ -504,13 +504,13 @@ response_cb (GtkDialog *dialog, gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (error_dialog), "%s", err->message); gtk_window_set_title (GTK_WINDOW (error_dialog), ""); - + gtk_dialog_run (GTK_DIALOG (error_dialog)); - + gtk_widget_destroy (error_dialog); g_error_free (err); } - + /* we don't want the dialog to close itself */ g_signal_stop_emission_by_name (dialog, "response"); break; @@ -525,19 +525,19 @@ static void gdict_pref_dialog_finalize (GObject *object) { GdictPrefDialog *dialog = GDICT_PREF_DIALOG (object); - + if (dialog->settings) g_object_unref (dialog->settings); - + if (dialog->builder) g_object_unref (dialog->builder); if (dialog->active_source) g_free (dialog->active_source); - + if (dialog->loader) g_object_unref (dialog->loader); - + G_OBJECT_CLASS (gdict_pref_dialog_parent_class)->finalize (object); } @@ -548,7 +548,7 @@ gdict_pref_dialog_set_property (GObject *object, GParamSpec *pspec) { GdictPrefDialog *dialog = GDICT_PREF_DIALOG (object); - + switch (prop_id) { case PROP_SOURCE_LOADER: @@ -566,7 +566,7 @@ gdict_pref_dialog_get_property (GObject *object, GParamSpec *pspec) { GdictPrefDialog *dialog = GDICT_PREF_DIALOG (object); - + switch (prop_id) { case PROP_SOURCE_LOADER: @@ -581,11 +581,11 @@ static void gdict_pref_dialog_class_init (GdictPrefDialogClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - + gobject_class->set_property = gdict_pref_dialog_set_property; gobject_class->get_property = gdict_pref_dialog_get_property; gobject_class->finalize = gdict_pref_dialog_finalize; - + g_object_class_install_property (gobject_class, PROP_SOURCE_LOADER, g_param_spec_object ("source-loader", @@ -604,7 +604,7 @@ gdict_pref_dialog_init (GdictPrefDialog *dialog) gtk_window_set_default_size (GTK_WINDOW (dialog), DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT); - + gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 2); @@ -632,9 +632,9 @@ gdict_pref_dialog_init (GdictPrefDialog *dialog) gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), GTK_WIDGET (gtk_builder_get_object (dialog->builder, "preferences_root"))); - /* keep all the interesting widgets around */ + /* keep all the interesting widgets around */ dialog->notebook = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "preferences_notebook")); - + dialog->sources_view = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "sources_treeview")); build_sources_view (dialog); @@ -645,7 +645,7 @@ gdict_pref_dialog_init (GdictPrefDialog *dialog) _("Add a new dictionary source")); g_signal_connect (dialog->sources_add, "clicked", G_CALLBACK (source_add_clicked_cb), dialog); - + dialog->sources_remove = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "remove_button")); gtk_widget_set_tooltip_text (dialog->sources_remove, _("Remove the currently selected dictionary source")); @@ -666,7 +666,7 @@ gdict_pref_dialog_init (GdictPrefDialog *dialog) g_signal_connect (dialog->font_button, "font-set", G_CALLBACK (font_button_font_set_cb), dialog); g_free (font); - + gtk_widget_show_all (dialog->notebook); /* we want to intercept the response signal before any other @@ -684,28 +684,28 @@ gdict_show_pref_dialog (GtkWidget *parent, GdictSourceLoader *loader) { GtkWidget *dialog; - + g_return_if_fail (GTK_IS_WIDGET (parent)); g_return_if_fail (GDICT_IS_SOURCE_LOADER (loader)); - + if (parent != NULL) dialog = g_object_get_data (G_OBJECT (parent), "gdict-pref-dialog"); else dialog = global_dialog; - + if (dialog == NULL) { dialog = g_object_new (GDICT_TYPE_PREF_DIALOG, "source-loader", loader, "title", title, NULL); - + g_object_ref_sink (dialog); - + g_signal_connect (dialog, "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), NULL); - + if (parent != NULL && GTK_IS_WINDOW (parent)) { gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent)); diff --git a/mate-dictionary/src/gdict-print.c b/mate-dictionary/src/gdict-print.c index 9e18bd6d..559f98b7 100644 --- a/mate-dictionary/src/gdict-print.c +++ b/mate-dictionary/src/gdict-print.c @@ -49,7 +49,7 @@ typedef struct _GdictPrintData gdouble font_size; gchar **lines; - + gint n_lines; gint lines_per_page; gint n_pages; @@ -100,10 +100,10 @@ draw_page (GtkPrintOperation *operation, width = gtk_print_context_get_width (context); cairo_rectangle (cr, 0, 0, width, HEADER_HEIGHT (10)); - + cairo_set_source_rgb (cr, 0.8, 0.8, 0.8); cairo_fill_preserve (cr); - + cairo_set_source_rgb (cr, 0, 0, 0); cairo_set_line_width (cr, 1); cairo_stroke (cr); @@ -138,7 +138,7 @@ draw_page (GtkPrintOperation *operation, cairo_move_to (cr, width - text_width - 4, (HEADER_HEIGHT (10) - text_height) / 2); pango_cairo_show_layout (cr, layout); - + g_object_unref (layout); /* text */ @@ -146,10 +146,10 @@ draw_page (GtkPrintOperation *operation, pango_font_description_set_size (data->font_desc, data->font_size * PANGO_SCALE); pango_layout_set_font_description (layout, data->font_desc); - + cairo_move_to (cr, 0, HEADER_HEIGHT (10) + HEADER_GAP (3)); line = page_number * data->lines_per_page; - for (i = 0; i < data->lines_per_page && line < data->n_lines; i++) + for (i = 0; i < data->lines_per_page && line < data->n_lines; i++) { pango_layout_set_text (layout, data->lines[line], -1); @@ -194,7 +194,7 @@ gdict_show_print_preview (GtkWindow *parent, gchar *print_font; gchar *word; GError *error; - + g_return_if_fail (parent == NULL || GTK_IS_WINDOW (parent)); g_return_if_fail (GDICT_IS_DEFBOX (defbox)); @@ -216,11 +216,11 @@ gdict_show_print_preview (GtkWindow *parent, / PANGO_SCALE; g_free (print_font); - g_signal_connect (operation, "begin-print", + g_signal_connect (operation, "begin-print", G_CALLBACK (begin_print), data); - g_signal_connect (operation, "draw-page", + g_signal_connect (operation, "draw-page", G_CALLBACK (draw_page), data); - g_signal_connect (operation, "end-print", + g_signal_connect (operation, "end-print", G_CALLBACK (end_print), data); error = NULL; @@ -258,7 +258,7 @@ gdict_show_print_dialog (GtkWindow *parent, gchar *print_font; gchar *word; GError *error; - + g_return_if_fail (parent == NULL || GTK_IS_WINDOW (parent)); g_return_if_fail (GDICT_IS_DEFBOX (defbox)); @@ -280,11 +280,11 @@ gdict_show_print_dialog (GtkWindow *parent, / PANGO_SCALE; g_free (print_font); - g_signal_connect (operation, "begin-print", + g_signal_connect (operation, "begin-print", G_CALLBACK (begin_print), data); - g_signal_connect (operation, "draw-page", + g_signal_connect (operation, "draw-page", G_CALLBACK (draw_page), data); - g_signal_connect (operation, "end-print", + g_signal_connect (operation, "end-print", G_CALLBACK (end_print), data); error = NULL; diff --git a/mate-dictionary/src/gdict-source-dialog.c b/mate-dictionary/src/gdict-source-dialog.c index 3fc17de5..d5dd54d3 100644 --- a/mate-dictionary/src/gdict-source-dialog.c +++ b/mate-dictionary/src/gdict-source-dialog.c @@ -49,7 +49,7 @@ struct _GdictSourceDialog { GtkDialog parent_instance; - GtkBuilder *builder; + GtkBuilder *builder; GSettings *settings; @@ -57,9 +57,9 @@ struct _GdictSourceDialog GdictSource *source; gchar *source_name; GdictContext *context; - + GdictSourceDialogAction action; - + GdictSourceTransport transport; GtkWidget *add_button; @@ -69,7 +69,7 @@ struct _GdictSourceDialog GtkWidget *db_chooser; GtkWidget *strat_chooser; - + GtkWidget *transport_combo; }; @@ -81,7 +81,7 @@ struct _GdictSourceDialogClass enum { PROP_0, - + PROP_SOURCE_LOADER, PROP_SOURCE_NAME, PROP_ACTION @@ -95,7 +95,7 @@ set_source_loader (GdictSourceDialog *dialog, { if (dialog->loader) g_object_unref (dialog->loader); - + dialog->loader = g_object_ref (loader); } @@ -116,11 +116,11 @@ transport_combo_changed_cb (GtkWidget *widget, gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (dialog->builder, "hostname_entry"))); gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (dialog->builder, "port_label"))); gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (dialog->builder, "port_entry"))); - + if (dialog->action == GDICT_SOURCE_DIALOG_CREATE) { gtk_widget_set_sensitive (dialog->add_button, TRUE); - + dialog->transport = GDICT_SOURCE_TRANSPORT_DICTD; } } @@ -134,7 +134,7 @@ transport_combo_changed_cb (GtkWidget *widget, if (dialog->action == GDICT_SOURCE_DIALOG_CREATE) { gtk_widget_set_sensitive (dialog->add_button, FALSE); - + dialog->transport = GDICT_SOURCE_TRANSPORT_INVALID; } } @@ -150,9 +150,9 @@ get_text_from_entry (GdictSourceDialog *dialog, entry = GTK_WIDGET (gtk_builder_get_object (dialog->builder, entry_name)); if (!entry) return NULL; - + retval = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1); - + return retval; } @@ -208,7 +208,7 @@ static void update_dialog_ui (GdictSourceDialog *dialog) { GdictSource *source; - + /* TODO - add code to update the contents of the dialog depending * on the action; if we are in _CREATE, no action is needed */ @@ -222,7 +222,7 @@ update_dialog_ui (GdictSourceDialog *dialog) "source name has been defined. Aborting..."); return; } - + source = gdict_source_loader_get_source (dialog->loader, dialog->source_name); if (!source) @@ -232,9 +232,9 @@ update_dialog_ui (GdictSourceDialog *dialog) dialog->source_name); return; } - + g_object_ref (source); - + dialog->source = source; set_text_to_entry (dialog, "description_entry", gdict_source_get_description (source)); @@ -252,7 +252,7 @@ update_dialog_ui (GdictSourceDialog *dialog) dialog->source_name); return; } - + set_transport_settings (dialog); gdict_database_chooser_set_context (GDICT_DATABASE_CHOOSER (dialog->db_chooser), @@ -286,16 +286,16 @@ build_new_source (GdictSourceDialog *dialog) gchar *filename; GdictDatabaseChooser *db_chooser; GdictStrategyChooser *strat_chooser; - + source = gdict_source_new (); - + /* use the timestamp and the pid to get a unique name */ name = g_strdup_printf ("source-%lu-%u", (gulong) time (NULL), (guint) getpid ()); gdict_source_set_name (source, name); g_free (name); - + text = get_text_from_entry (dialog, "description_entry"); gdict_source_set_description (source, text); g_free (text); @@ -317,12 +317,12 @@ build_new_source (GdictSourceDialog *dialog) case GDICT_SOURCE_TRANSPORT_DICTD: host = get_text_from_entry (dialog, "hostname_entry"); port = get_text_from_entry (dialog, "port_entry"); - + gdict_source_set_transport (source, GDICT_SOURCE_TRANSPORT_DICTD, "hostname", host, "port", atoi (port), NULL); - + g_free (host); g_free (port); break; @@ -331,7 +331,7 @@ build_new_source (GdictSourceDialog *dialog) g_warning ("Invalid transport"); return; } - + error = NULL; data = gdict_source_to_data (source, &length, &error); if (error) @@ -339,11 +339,11 @@ build_new_source (GdictSourceDialog *dialog) gdict_show_gerror_dialog (GTK_WINDOW (dialog), _("Unable to create a source file"), error); - + g_object_unref (source); return; } - + name = g_strdup_printf ("%s.desktop", gdict_source_get_name (source)); filename = g_build_filename (g_get_user_config_dir (), "mate", @@ -351,7 +351,7 @@ build_new_source (GdictSourceDialog *dialog) name, NULL); g_free (name); - + g_file_set_contents (filename, data, length, &error); if (error) gdict_show_gerror_dialog (GTK_WINDOW (dialog), @@ -376,7 +376,7 @@ save_source (GdictSourceDialog *dialog) gsize length; GError *error; gchar *filename; - + source = gdict_source_loader_get_source (dialog->loader, dialog->source_name); if (!source) @@ -387,7 +387,7 @@ save_source (GdictSourceDialog *dialog) return; } - + text = get_text_from_entry (dialog, "description_entry"); gdict_source_set_description (source, text); g_free (text); @@ -410,12 +410,12 @@ save_source (GdictSourceDialog *dialog) case GDICT_SOURCE_TRANSPORT_DICTD: host = get_text_from_entry (dialog, "hostname_entry"); port = get_text_from_entry (dialog, "port_entry"); - + gdict_source_set_transport (source, GDICT_SOURCE_TRANSPORT_DICTD, "hostname", host, "port", atoi (port), NULL); - + g_free (host); g_free (port); break; @@ -424,7 +424,7 @@ save_source (GdictSourceDialog *dialog) g_warning ("Invalid transport"); return; } - + error = NULL; data = gdict_source_to_data (source, &length, &error); if (error) @@ -432,11 +432,11 @@ save_source (GdictSourceDialog *dialog) gdict_show_gerror_dialog (GTK_WINDOW (dialog), _("Unable to create a source file"), error); - + g_object_unref (source); return; } - + name = g_strdup_printf ("%s.desktop", gdict_source_get_name (source)); filename = g_build_filename (g_get_user_config_dir (), "mate", @@ -444,7 +444,7 @@ save_source (GdictSourceDialog *dialog) name, NULL); g_free (name); - + g_file_set_contents (filename, data, length, &error); if (error) gdict_show_gerror_dialog (GTK_WINDOW (dialog), @@ -462,7 +462,7 @@ gdict_source_dialog_response_cb (GtkDialog *dialog, gpointer user_data) { GError *err = NULL; - + switch (response_id) { case GTK_RESPONSE_ACCEPT: @@ -499,7 +499,7 @@ gdict_source_dialog_finalize (GObject *object) if (dialog->settings) g_object_unref (dialog->settings); - + if (dialog->builder) g_object_unref (dialog->builder); @@ -508,10 +508,10 @@ gdict_source_dialog_finalize (GObject *object) if (dialog->source) g_object_unref (dialog->source); - + if (dialog->loader) g_object_unref (dialog->loader); - + G_OBJECT_CLASS (gdict_source_dialog_parent_class)->finalize (object); } @@ -522,7 +522,7 @@ gdict_source_dialog_set_property (GObject *object, GParamSpec *pspec) { GdictSourceDialog *dialog = GDICT_SOURCE_DIALOG (object); - + switch (prop_id) { case PROP_SOURCE_LOADER: @@ -547,7 +547,7 @@ gdict_source_dialog_get_property (GObject *object, GParamSpec *pspec) { GdictSourceDialog *dialog = GDICT_SOURCE_DIALOG (object); - + switch (prop_id) { case PROP_SOURCE_LOADER: @@ -592,7 +592,7 @@ gdict_source_dialog_constructor (GType type, g_error_free (error); g_assert_not_reached (); } - + /* the main widget */ gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), GTK_WIDGET (gtk_builder_get_object (dialog->builder, "source_root"))); @@ -609,7 +609,7 @@ gdict_source_dialog_constructor (GType type, dialog->help_button = gtk_dialog_add_button (GTK_DIALOG (dialog), "gtk-help", GTK_RESPONSE_HELP); - + vbox = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "db-vbox")); dialog->db_chooser = gdict_database_chooser_new (); gtk_box_pack_start (GTK_BOX (vbox), dialog->db_chooser, TRUE, TRUE, 0); @@ -631,7 +631,7 @@ gdict_source_dialog_constructor (GType type, gtk_editable_set_editable (GTK_EDITABLE (gtk_builder_get_object (dialog->builder, "description_entry")), FALSE); gtk_editable_set_editable (GTK_EDITABLE (gtk_builder_get_object (dialog->builder, "hostname_entry")), FALSE); gtk_editable_set_editable (GTK_EDITABLE (gtk_builder_get_object (dialog->builder, "port_entry")), FALSE); - + gtk_widget_set_sensitive (dialog->transport_combo, FALSE); /* we just allow closing the dialog */ @@ -663,7 +663,7 @@ gdict_source_dialog_constructor (GType type, g_assert_not_reached (); break; } - + /* this will take care of updating the contents of the dialog * based on the action */ @@ -676,12 +676,12 @@ static void gdict_source_dialog_class_init (GdictSourceDialogClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - + gobject_class->constructor = gdict_source_dialog_constructor; gobject_class->set_property = gdict_source_dialog_set_property; gobject_class->get_property = gdict_source_dialog_get_property; gobject_class->finalize = gdict_source_dialog_finalize; - + g_object_class_install_property (gobject_class, PROP_SOURCE_LOADER, g_param_spec_object ("source-loader", @@ -728,10 +728,10 @@ gdict_source_dialog_new (GtkWindow *parent, const gchar *source_name) { GtkWidget *retval; - + g_return_val_if_fail ((parent == NULL || GTK_IS_WINDOW (parent)), NULL); g_return_val_if_fail (GDICT_IS_SOURCE_LOADER (loader), NULL); - + retval = g_object_new (GDICT_TYPE_SOURCE_DIALOG, "source-loader", loader, "source-name", source_name, @@ -746,6 +746,6 @@ gdict_source_dialog_new (GtkWindow *parent, gtk_window_set_screen (GTK_WINDOW (retval), gtk_widget_get_screen (GTK_WIDGET (parent))); } - + return retval; } diff --git a/mate-dictionary/src/gdict-window.c b/mate-dictionary/src/gdict-window.c index 7921537c..2f4b9d9c 100644 --- a/mate-dictionary/src/gdict-window.c +++ b/mate-dictionary/src/gdict-window.c @@ -83,7 +83,7 @@ enum enum { CREATED, - + LAST_SIGNAL }; @@ -115,7 +115,7 @@ gdict_window_finalize (GObject *gobject) g_free (window->word); g_free (window->database); g_free (window->strategy); - + G_OBJECT_CLASS (gdict_window_parent_class)->finalize (gobject); } @@ -136,7 +136,7 @@ gdict_window_dispose (GObject *gobject) window->settings = NULL; } - + if (window->context) { if (window->lookup_start_id) @@ -155,19 +155,19 @@ gdict_window_dispose (GObject *gobject) g_object_unref (window->context); window->context = NULL; } - + if (window->loader) { g_object_unref (window->loader); window->loader = NULL; } - + if (window->ui_manager) { g_object_unref (window->ui_manager); window->ui_manager = NULL; } - + if (window->action_group) { g_object_unref (window->action_group); @@ -315,7 +315,7 @@ gdict_window_lookup_start_cb (GdictContext *context, window->busy_cursor = gdk_cursor_new_for_display (display, GDK_WATCH); message = g_strdup_printf (_("Searching for '%s'..."), window->word); - + if (window->status && window->statusbar_visible) gtk_statusbar_push (GTK_STATUSBAR (window->status), 0, message); @@ -340,14 +340,14 @@ gdict_window_lookup_end_cb (GdictContext *context, GtkTreeIter iter; GdictSource *source; GdictContext *speller_context; - + count = window->current_definition; window->max_definition = count - 1; if (count == 0) message = g_strdup (_("No definitions found")); - else + else message = g_strdup_printf (ngettext("A definition found", "%d definitions found", count), @@ -400,7 +400,7 @@ gdict_window_error_cb (GdictContext *context, GdictWindow *window) { gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (window)), NULL); - + if (window->status && window->statusbar_visible) gtk_statusbar_push (GTK_STATUSBAR (window->status), 0, _("No definitions found")); @@ -429,10 +429,10 @@ gdict_window_error_cb (GdictContext *context, context); g_object_unref (context); g_object_unref (source); - + gdict_speller_set_strategy (GDICT_SPELLER (window->speller), window->strategy); - + gdict_speller_match (GDICT_SPELLER (window->speller), window->word); } @@ -514,46 +514,46 @@ get_context_from_loader (GdictWindow *window) source = gdict_source_loader_get_source (window->loader, window->source_name); } - + if (!source) { gchar *detail; - + detail = g_strdup_printf (_("No dictionary source available with name '%s'"), window->source_name); gdict_show_error_dialog (GTK_WINDOW (window), _("Unable to find dictionary source"), detail); - + g_free (detail); return NULL; } - + gdict_window_set_database (window, gdict_source_get_database (source)); gdict_window_set_strategy (window, gdict_source_get_strategy (source)); - + retval = gdict_source_get_context (source); if (!retval) { gchar *detail; - + detail = g_strdup_printf (_("No context available for source '%s'"), gdict_source_get_description (source)); - + gdict_show_error_dialog (GTK_WINDOW (window), _("Unable to create a context"), detail); - + g_free (detail); g_object_unref (source); - + return NULL; } - + g_object_unref (source); - + return retval; } @@ -589,7 +589,7 @@ gdict_window_set_word (GdictWindow *window, const gchar *database) { gchar *title; - + g_free (window->word); window->word = NULL; @@ -605,7 +605,7 @@ gdict_window_set_word (GdictWindow *window, title = g_strdup_printf (_("%s - Dictionary"), window->word); else title = g_strdup (_("Dictionary")); - + gtk_window_set_title (GTK_WINDOW (window), title); g_free (title); @@ -626,12 +626,12 @@ gdict_window_set_context (GdictWindow *window, g_signal_handler_disconnect (window->context, window->lookup_start_id); g_signal_handler_disconnect (window->context, window->lookup_end_id); g_signal_handler_disconnect (window->context, window->error_id); - + window->definition_id = 0; window->lookup_start_id = 0; window->lookup_end_id = 0; window->error_id = 0; - + g_object_unref (window->context); window->context = NULL; } @@ -647,7 +647,7 @@ gdict_window_set_context (GdictWindow *window, if (!context) return; - + /* attach our callbacks */ window->definition_id = g_signal_connect (context, "definition-found", G_CALLBACK (gdict_window_definition_cb), @@ -661,7 +661,7 @@ gdict_window_set_context (GdictWindow *window, window->error_id = g_signal_connect (context, "error", G_CALLBACK (gdict_window_error_cb), window); - + window->context = context; } @@ -699,7 +699,7 @@ gdict_window_set_property (GObject *object, GParamSpec *pspec) { GdictWindow *window = GDICT_WINDOW (object); - + switch (prop_id) { case PROP_ACTION: @@ -742,7 +742,7 @@ gdict_window_get_property (GObject *object, GParamSpec *pspec) { GdictWindow *window = GDICT_WINDOW (object); - + switch (prop_id) { case PROP_ACTION: @@ -947,7 +947,7 @@ gdict_window_cmd_file_new (GtkAction *action, NULL, NULL); gtk_widget_show (new_window); - + g_signal_emit (window, gdict_window_signals[CREATED], 0, new_window); } @@ -956,9 +956,9 @@ gdict_window_cmd_save_as (GtkAction *action, GdictWindow *window) { GtkWidget *dialog; - + g_assert (GDICT_IS_WINDOW (window)); - + dialog = gtk_file_chooser_dialog_new (_("Save a Copy"), GTK_WINDOW (window), GTK_FILE_CHOOSER_ACTION_SAVE, @@ -966,22 +966,22 @@ gdict_window_cmd_save_as (GtkAction *action, "gtk-save", GTK_RESPONSE_ACCEPT, NULL); gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE); - + /* default to user's home */ gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), g_get_home_dir ()); gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), _("Untitled document")); - + if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) { gchar *filename; gchar *text; gsize len; GError *write_error = NULL; - + filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); - + text = gdict_defbox_get_text (GDICT_DEFBOX (window->defbox), &len); - + g_file_set_contents (filename, text, len, @@ -989,16 +989,16 @@ gdict_window_cmd_save_as (GtkAction *action, if (write_error) { gchar *message; - + message = g_strdup_printf (_("Error while writing to '%s'"), filename); - + gdict_show_gerror_dialog (GTK_WINDOW (window), message, write_error); g_free (message); } - + g_free (text); g_free (filename); } @@ -1021,7 +1021,7 @@ gdict_window_cmd_file_print (GtkAction *action, GdictWindow *window) { g_assert (GDICT_IS_WINDOW (window)); - + gdict_show_print_dialog (GTK_WINDOW (window), GDICT_DEFBOX (window->defbox)); } @@ -1072,7 +1072,7 @@ gdict_window_cmd_edit_find (GtkAction *action, GdictWindow *window) { g_assert (GDICT_IS_WINDOW (window)); - + gdict_defbox_set_show_find (GDICT_DEFBOX (window->defbox), TRUE); } @@ -1099,7 +1099,7 @@ gdict_window_cmd_edit_preferences (GtkAction *action, GdictWindow *window) { g_assert (GDICT_IS_WINDOW (window)); - + gdict_show_pref_dialog (GTK_WIDGET (window), _("Dictionary Preferences"), window->loader); @@ -1183,7 +1183,7 @@ gdict_window_cmd_go_first_def (GtkAction *action, GdictWindow *window) { g_assert (GDICT_IS_WINDOW (window)); - + window->last_definition = 0; gdict_defbox_jump_to_definition (GDICT_DEFBOX (window->defbox), window->last_definition); @@ -1194,10 +1194,10 @@ gdict_window_cmd_go_previous_def (GtkAction *action, GdictWindow *window) { g_assert (GDICT_IS_WINDOW (window)); - + if (window->last_definition == 0) return; - + window->last_definition -= 1; gdict_defbox_jump_to_definition (GDICT_DEFBOX (window->defbox), window->last_definition); @@ -1208,13 +1208,13 @@ gdict_window_cmd_go_next_def (GtkAction *action, GdictWindow *window) { g_assert (GDICT_IS_WINDOW (window)); - + if (window->max_definition == -1) window->max_definition = gdict_defbox_count_definitions (GDICT_DEFBOX (window->defbox)) - 1; - + if (window->last_definition == window->max_definition) return; - + window->last_definition += 1; gdict_defbox_jump_to_definition (GDICT_DEFBOX (window->defbox), window->last_definition); @@ -1225,10 +1225,10 @@ gdict_window_cmd_go_last_def (GtkAction *action, GdictWindow *window) { g_assert (GDICT_IS_WINDOW (window)); - + if (window->max_definition == -1) window->last_definition = gdict_defbox_count_definitions (GDICT_DEFBOX (window->defbox)) - 1; - + window->last_definition = window->max_definition; gdict_defbox_jump_to_definition (GDICT_DEFBOX (window->defbox), window->last_definition); @@ -1239,12 +1239,12 @@ gdict_window_cmd_help_contents (GtkAction *action, GdictWindow *window) { GError *err = NULL; - + g_return_if_fail (GDICT_IS_WINDOW (window)); gtk_show_uri_on_window (GTK_WINDOW (window), "help:mate-dictionary", - gtk_get_current_event_time (), &err); + gtk_get_current_event_time (), &err); if (err) { gdict_show_gerror_dialog (GTK_WINDOW (window), @@ -1258,7 +1258,7 @@ gdict_window_cmd_help_about (GtkAction *action, GdictWindow *window) { g_assert (GDICT_IS_WINDOW (window)); - + gdict_show_about_dialog (GTK_WIDGET (window)); } @@ -1276,7 +1276,7 @@ gdict_window_cmd_escape (GtkAction *action, GdictWindow *window) { g_assert (GDICT_IS_WINDOW (window)); - + gdict_defbox_set_show_find (GDICT_DEFBOX (window->defbox), FALSE); } @@ -1340,7 +1340,7 @@ static const GtkActionEntry entries[] = G_CALLBACK (gdict_window_cmd_help_contents) }, { "HelpAbout", "help-about", N_("_About"), NULL, NULL, G_CALLBACK (gdict_window_cmd_help_about) }, - + /* Accelerators */ { "Lookup", NULL, "", "<control>L", NULL, G_CALLBACK (gdict_window_cmd_lookup) }, { "Escape", NULL, "", "Escape", "", G_CALLBACK (gdict_window_cmd_escape) }, @@ -1371,12 +1371,12 @@ gdict_window_state_event_cb (GtkWidget *widget, gpointer user_data) { GdictWindow *window = GDICT_WINDOW (widget); - + if (event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED) window->is_maximized = TRUE; else window->is_maximized = FALSE; - + return FALSE; } @@ -1386,12 +1386,12 @@ lookup_word (GdictWindow *window, { const gchar *entry_text; gchar *word; - + g_assert (GDICT_IS_WINDOW (window)); - + if (!window->context) return; - + entry_text = gtk_entry_get_text (GTK_ENTRY (window->entry)); if (!entry_text || *entry_text == '\0') return; @@ -1470,7 +1470,7 @@ speller_word_activated_cb (GdictSpeller *speller, GdictWindow *window) { gtk_entry_set_text (GTK_ENTRY (window->entry), word); - + gdict_window_set_word (window, word, db_name); if (window->status && window->statusbar_visible) @@ -1509,7 +1509,7 @@ sidebar_page_changed_cb (GdictSidebar *sidebar, break; case 't': /* strat-chooser */ message = _("Double-click on the matching strategy to use"); - + gdict_strategy_chooser_refresh (GDICT_STRATEGY_CHOOSER (window->strat_chooser)); break; case 'o': /* source-chooser */ @@ -1523,7 +1523,7 @@ sidebar_page_changed_cb (GdictSidebar *sidebar, break; case 'd': /* db-chooser */ message = _("Double-click on the database to use"); - + gdict_database_chooser_refresh (GDICT_DATABASE_CHOOSER (window->db_chooser)); break; default: @@ -1539,7 +1539,7 @@ static void sidebar_closed_cb (GdictSidebar *sidebar, GdictWindow *window) { - gdict_window_set_sidebar_visible (window, FALSE); + gdict_window_set_sidebar_visible (window, FALSE); } static void @@ -1555,7 +1555,7 @@ gdict_window_link_clicked (GdictDefbox *defbox, window->loader, NULL, link_text); gtk_widget_show (new_window); - + g_signal_emit (window, gdict_window_signals[CREATED], 0, new_window); } @@ -1571,7 +1571,7 @@ gdict_window_drag_data_received_cb (GtkWidget *widget, { GdictWindow *window = GDICT_WINDOW (user_data); gchar *text; - + text = (gchar *) gtk_selection_data_get_text (data); if (text) { @@ -1579,7 +1579,7 @@ gdict_window_drag_data_received_cb (GtkWidget *widget, gdict_window_set_word (window, text, NULL); g_free (text); - + gtk_drag_finish (context, TRUE, FALSE, time_); } else @@ -1649,7 +1649,7 @@ gdict_window_constructor (GType type, window->main_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_container_add (GTK_CONTAINER (window), window->main_box); gtk_widget_show (window->main_box); - + /* build menus */ action_group = gtk_action_group_new ("MenuActions"); window->action_group = action_group; @@ -1660,13 +1660,13 @@ gdict_window_constructor (GType type, gtk_action_group_add_toggle_actions (action_group, toggle_entries, G_N_ELEMENTS (toggle_entries), window); - + window->ui_manager = gtk_ui_manager_new (); gtk_ui_manager_insert_action_group (window->ui_manager, action_group, 0); - + accel_group = gtk_ui_manager_get_accel_group (window->ui_manager); gtk_window_add_accel_group (GTK_WINDOW (window), accel_group); - + error = NULL; if (!gtk_ui_manager_add_ui_from_file (window->ui_manager, PKGDATADIR "/mate-dictionary-ui.xml", @@ -1678,22 +1678,22 @@ gdict_window_constructor (GType type, else { window->menubar = gtk_ui_manager_get_widget (window->ui_manager, "/MainMenu"); - + gtk_box_pack_start (GTK_BOX (window->main_box), window->menubar, FALSE, FALSE, 0); gtk_widget_show (window->menubar); gdict_window_ensure_menu_state (window); } - + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_container_set_border_width (GTK_CONTAINER (vbox), 6); gtk_container_add (GTK_CONTAINER (window->main_box), vbox); gtk_widget_show (vbox); - + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); - + button = gtk_button_new_with_mnemonic (_("Look _up:")); g_signal_connect_swapped (button, "clicked", G_CALLBACK (lookup_word), @@ -1704,18 +1704,18 @@ gdict_window_constructor (GType type, window->completion_model = gtk_list_store_new (COMPLETION_N_COLUMNS, G_TYPE_STRING); - + window->completion = gtk_entry_completion_new (); gtk_entry_completion_set_popup_completion (window->completion, TRUE); gtk_entry_completion_set_model (window->completion, GTK_TREE_MODEL (window->completion_model)); gtk_entry_completion_set_text_column (window->completion, COMPLETION_TEXT_COLUMN); - + window->entry = gtk_entry_new (); if (window->word) gtk_entry_set_text (GTK_ENTRY (window->entry), window->word); - + gtk_entry_set_completion (GTK_ENTRY (window->entry), window->completion); g_signal_connect_swapped (window->entry, "activate", @@ -1730,7 +1730,7 @@ gdict_window_constructor (GType type, frame1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); frame2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - + window->defbox = gdict_defbox_new (); if (window->context) gdict_defbox_set_context (GDICT_DEFBOX (window->defbox), window->context); @@ -1758,7 +1758,7 @@ gdict_window_constructor (GType type, G_CALLBACK (sidebar_closed_cb), window); gtk_widget_show (window->sidebar); - + /* Speller */ window->speller = gdict_speller_new (); if (window->context) @@ -1875,7 +1875,7 @@ gdict_window_constructor (GType type, { gint font_size; gint width, height; - + font_size = pango_font_description_get_size (font_desc); font_size = PANGO_PIXELS (font_size); @@ -1887,7 +1887,7 @@ gdict_window_constructor (GType type, } pango_font_description_free (font_desc); - + gtk_window_set_title (GTK_WINDOW (window), _("Dictionary")); gtk_window_set_default_size (GTK_WINDOW (window), window->default_width, @@ -2021,7 +2021,7 @@ static void gdict_window_init (GdictWindow *window) { window->action = GDICT_WINDOW_ACTION_CLEAR; - + window->loader = NULL; window->context = NULL; @@ -2042,7 +2042,7 @@ gdict_window_init (GdictWindow *window) window->sidebar_visible = FALSE; window->statusbar_visible = FALSE; window->sidebar_page = NULL; - + window->window_id = (gulong) time (NULL); /* we need to create the chooser widgets for the sidebar before @@ -2060,9 +2060,9 @@ gdict_window_new (GdictWindowAction action, { GtkWidget *retval; GdictWindow *window; - + g_return_val_if_fail (GDICT_IS_SOURCE_LOADER (loader), NULL); - + retval = g_object_new (GDICT_TYPE_WINDOW, "action", action, "source-loader", loader, @@ -2086,7 +2086,7 @@ gdict_window_new (GdictWindowAction action, GdictContext *context; gtk_entry_set_text (GTK_ENTRY (window->entry), word); - + gdict_window_set_sidebar_visible (window, TRUE); gdict_sidebar_view_page (GDICT_SIDEBAR (window->sidebar), GDICT_SIDEBAR_SPELLER_PAGE); @@ -2100,13 +2100,13 @@ gdict_window_new (GdictWindowAction action, context = gdict_source_get_context (source); gdict_speller_set_context (GDICT_SPELLER (window->speller), context); - + g_object_unref (context); g_object_unref (source); - + gdict_speller_set_strategy (GDICT_SPELLER (window->speller), window->strategy); - + gdict_speller_match (GDICT_SPELLER (window->speller), word); } break; diff --git a/mate-dictionary/src/gdict-window.h b/mate-dictionary/src/gdict-window.h index f2353e92..02a2ee7a 100644 --- a/mate-dictionary/src/gdict-window.h +++ b/mate-dictionary/src/gdict-window.h @@ -49,11 +49,11 @@ typedef struct _GdictWindowClass GdictWindowClass; struct _GdictWindow { GtkWindow parent_instance; - + GtkWidget *main_box; GtkWidget *menubar; GtkWidget *entry; - + /* sidebar widgets */ GtkWidget *speller; GtkWidget *db_chooser; @@ -62,26 +62,26 @@ struct _GdictWindow GtkWidget *sidebar; GtkWidget *sidebar_frame; - + GtkWidget *defbox; GtkWidget *defbox_frame; GtkWidget *status; GtkWidget *progress; - + GtkUIManager *ui_manager; GtkActionGroup *action_group; - + GtkEntryCompletion *completion; GtkListStore *completion_model; - + GdictWindowAction action; - + gchar *word; gint max_definition; gint last_definition; gint current_definition; - + gchar *source_name; GdictSourceLoader *loader; GdictContext *context; @@ -89,7 +89,7 @@ struct _GdictWindow guint lookup_start_id; guint lookup_end_id; guint error_id; - + gchar *database; gchar *strategy; gchar *print_font; @@ -112,14 +112,14 @@ struct _GdictWindow guint sidebar_visible : 1; guint statusbar_visible : 1; guint in_construction : 1; - + gulong window_id; }; struct _GdictWindowClass { GtkWindowClass parent_class; - + void (*created) (GdictWindow *parent_window, GdictWindow *new_window); }; diff --git a/mate-screenshot/src/mate-screenshot.c b/mate-screenshot/src/mate-screenshot.c index 6537e4cc..bfbc4346 100644 --- a/mate-screenshot/src/mate-screenshot.c +++ b/mate-screenshot/src/mate-screenshot.c @@ -79,7 +79,7 @@ typedef enum TEST_TMP = 2, } TestType; -typedef struct +typedef struct { char *base_uris[3]; char *retval; @@ -172,7 +172,7 @@ target_toggled_cb (GtkToggleButton *button, { take_window_shot = (target_toggle == TARGET_TOGGLE_WINDOW); take_area_shot = (target_toggle == TARGET_TOGGLE_AREA); - + gtk_widget_set_sensitive (border_check, take_window_shot); gtk_widget_set_sensitive (effect_combo, take_window_shot); gtk_widget_set_sensitive (effect_label, take_window_shot); @@ -223,7 +223,7 @@ effect_combo_changed_cb (GtkComboBox *combo, } } -static gint +static gint key_press_cb (GtkWidget* widget, GdkEventKey* event, gpointer data) { if (event->keyval == GDK_KEY_F1) @@ -266,7 +266,7 @@ create_effects_combo (void) G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT); - + for (i = 0; i < n_effects; i++) { GtkTreeIter iter; @@ -301,7 +301,7 @@ create_effects_combo (void) default: break; } - + renderer = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (retval), renderer, TRUE); gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (retval), renderer, @@ -541,7 +541,7 @@ create_interactive_dialog (void) NULL); g_signal_connect (G_OBJECT (retval), "key-press-event", - G_CALLBACK(key_press_cb), + G_CALLBACK(key_press_cb), NULL); return retval; @@ -578,7 +578,7 @@ set_recent_entry (ScreenshotDialog *dialog) uri = screenshot_dialog_get_uri (dialog); recent = gtk_recent_manager_get_default (); - + exec_name = g_app_info_get_executable (app); app_exec = g_strjoin (" ", exec_name, "%u", NULL); @@ -603,7 +603,7 @@ error_dialog_response_cb (GtkDialog *d, ScreenshotDialog *dialog) { gtk_widget_destroy (GTK_WIDGET (d)); - + screenshot_dialog_focus_entry (dialog); } @@ -614,7 +614,7 @@ save_callback (TransferResult result, { ScreenshotDialog *dialog = data; GtkWidget *toplevel; - + toplevel = screenshot_dialog_get_toplevel (dialog); screenshot_dialog_set_busy (dialog, FALSE); @@ -623,7 +623,7 @@ save_callback (TransferResult result, save_folder_to_settings (dialog); set_recent_entry (dialog); gtk_widget_destroy (toplevel); - + /* we're done, stop the mainloop now */ gtk_main_quit (); } @@ -642,7 +642,7 @@ save_callback (TransferResult result, */ GtkWidget *error_dialog; char *uri; - + uri = screenshot_dialog_get_uri (dialog); error_dialog = gtk_message_dialog_new (GTK_WINDOW (toplevel), GTK_DIALOG_DESTROY_WITH_PARENT, @@ -662,7 +662,7 @@ save_callback (TransferResult result, g_free (uri); } - + } static void @@ -677,12 +677,12 @@ try_to_save (ScreenshotDialog *dialog, source_file = g_file_new_for_path (temporary_file); target_file = g_file_new_for_uri (target); - + screenshot_xfer_uri (source_file, target_file, screenshot_dialog_get_toplevel (dialog), save_callback, dialog); - + /* screenshot_xfer_uri () holds a ref, so we can unref now */ g_object_unref (source_file); g_object_unref (target_file); @@ -759,7 +759,7 @@ screenshot_dialog_response_cb (GtkDialog *d, gtk_main_quit (); } } - + static void run_dialog (ScreenshotDialog *dialog) @@ -767,9 +767,9 @@ run_dialog (ScreenshotDialog *dialog) GtkWidget *toplevel; toplevel = screenshot_dialog_get_toplevel (dialog); - + gtk_widget_show (toplevel); - + g_signal_connect (toplevel, "response", G_CALLBACK (screenshot_dialog_response_cb), @@ -817,7 +817,7 @@ play_sound_effect (GdkWindow *window) static void finish_prepare_screenshot (char *initial_uri, GdkWindow *window, GdkRectangle *rectangle) -{ +{ ScreenshotDialog *dialog; gboolean include_mask = (!take_window_shot && !take_area_shot); @@ -894,7 +894,7 @@ check_file_done (gpointer user_data) finish_prepare_screenshot (job->retval, job->window, job->rectangle); async_existence_job_free (job); - + return FALSE; } @@ -1086,7 +1086,7 @@ push_check_file_job (GdkRectangle *rectangle) job, NULL, 0, NULL); - + } static void @@ -1153,7 +1153,7 @@ expand_initial_tilde (const char *path) if (path[1] == '/' || path[1] == '\0') { return g_strconcat (g_get_home_dir (), &path[1], NULL); } - + slash_after_user_name = strchr (&path[1], '/'); if (slash_after_user_name == NULL) { user_name = g_strdup (&path[1]); @@ -1163,11 +1163,11 @@ expand_initial_tilde (const char *path) } passwd_file_entry = getpwnam (user_name); g_free (user_name); - + if (passwd_file_entry == NULL || passwd_file_entry->pw_dir == NULL) { return g_strdup (path); } - + return g_strconcat (passwd_file_entry->pw_dir, slash_after_user_name, NULL); @@ -1285,7 +1285,7 @@ loop_dialog_screenshot () if (interactive_arg) { /* HACK: give time to the dialog to actually disappear. - * We don't have any way to tell when the compositor has finished + * We don't have any way to tell when the compositor has finished * re-drawing. */ g_timeout_add (200, @@ -1345,7 +1345,7 @@ main (int argc, char *argv[]) } g_option_context_free (context); - + if (version_arg) { g_print ("%s %s\n", g_get_application_name (), VERSION); exit (EXIT_SUCCESS); diff --git a/mate-screenshot/src/screenshot-dialog.c b/mate-screenshot/src/screenshot-dialog.c index db7a0f67..f9450582 100644 --- a/mate-screenshot/src/screenshot-dialog.c +++ b/mate-screenshot/src/screenshot-dialog.c @@ -30,7 +30,7 @@ enum { TYPE_IMAGE_PNG, TYPE_TEXT_URI_LIST, - + LAST_TYPE }; @@ -139,7 +139,7 @@ drag_data_get (GtkWidget *widget, screenshot_save_get_filename (), NULL); uris[1] = NULL; - + gtk_selection_data_set_uris (selection_data, uris); g_strfreev (uris); } @@ -270,7 +270,7 @@ screenshot_dialog_new (GdkPixbuf *screenshot, gtk_editable_select_region (GTK_EDITABLE (dialog->filename_entry), 0, pos); - + g_free (current_name); return dialog; diff --git a/mate-screenshot/src/screenshot-save.c b/mate-screenshot/src/screenshot-save.c index 414fe285..85559ed6 100644 --- a/mate-screenshot/src/screenshot-save.c +++ b/mate-screenshot/src/screenshot-save.c @@ -138,14 +138,14 @@ make_temp_directory (void) { gint result, i; gchar *dir_name; - + i = 0; do { gchar *tmp_dir = g_strdup_printf ("mate-screenshot.%u.%d", (unsigned int) getpid (), i++); - + dir_name = g_build_filename (g_get_tmp_dir (), tmp_dir, NULL); diff --git a/mate-screenshot/src/screenshot-shadow.c b/mate-screenshot/src/screenshot-shadow.c index 052bb9f3..76e75812 100644 --- a/mate-screenshot/src/screenshot-shadow.c +++ b/mate-screenshot/src/screenshot-shadow.c @@ -54,13 +54,13 @@ create_blur_filter (int radius) ConvFilter *filter; int x, y; double sum; - + filter = g_new0 (ConvFilter, 1); filter->size = radius * 2 + 1; filter->data = g_new (double, filter->size * filter->size); sum = 0.0; - + for (y = 0 ; y < filter->size; y++) { for (x = 0 ; x < filter->size; x++) @@ -80,7 +80,7 @@ create_blur_filter (int radius) } return filter; - + } static ConvFilter * @@ -88,7 +88,7 @@ create_outline_filter (int radius) { ConvFilter *filter; double *iter; - + filter = g_new0 (ConvFilter, 1); filter->size = radius * 2 + 1; filter->data = g_new (double, filter->size * filter->size); @@ -118,7 +118,7 @@ create_effect (GdkPixbuf *src, int src_width, src_height; int src_rowstride, dest_rowstride; gboolean src_has_alpha; - + guchar *src_pixels, *dest_pixels; src_has_alpha = gdk_pixbuf_get_has_alpha (src); @@ -132,15 +132,15 @@ create_effect (GdkPixbuf *src, TRUE, gdk_pixbuf_get_bits_per_sample (src), dest_width, dest_height); - - gdk_pixbuf_fill (dest, 0); - + + gdk_pixbuf_fill (dest, 0); + src_pixels = gdk_pixbuf_get_pixels (src); src_rowstride = gdk_pixbuf_get_rowstride (src); - + dest_pixels = gdk_pixbuf_get_pixels (dest); dest_rowstride = gdk_pixbuf_get_rowstride (dest); - + for (y = 0; y < dest_height; y++) { for (x = 0; x < dest_width; x++) @@ -150,10 +150,10 @@ create_effect (GdkPixbuf *src, src_x = x - radius; src_y = y - radius; - /* We don't need to compute effect here, since this pixel will be + /* We don't need to compute effect here, since this pixel will be * discarded when compositing */ if (src_x >= 0 && src_x < src_width && - src_y >= 0 && src_y < src_height && + src_y >= 0 && src_y < src_height && (!src_has_alpha || src_pixels [src_y * src_rowstride + src_x * 4 + 3] == 0xFF)) continue; @@ -169,7 +169,7 @@ create_effect (GdkPixbuf *src, src_x < 0 || src_x >= src_width) continue; - suma += ( src_has_alpha ? + suma += ( src_has_alpha ? src_pixels [src_y * src_rowstride + src_x * 4 + 3] : 0xFF ) * filter->data [i * filter->size + j]; } @@ -178,7 +178,7 @@ create_effect (GdkPixbuf *src, dest_pixels [y * dest_rowstride + x * 4 + 3] = CLAMP (suma * opacity, 0x00, 0xFF); } } - + return dest; } @@ -187,11 +187,11 @@ screenshot_add_shadow (GdkPixbuf **src) { GdkPixbuf *dest; static ConvFilter *filter = NULL; - + if (!filter) filter = create_blur_filter (BLUR_RADIUS); - - dest = create_effect (*src, filter, + + dest = create_effect (*src, filter, BLUR_RADIUS, SHADOW_OFFSET, SHADOW_OPACITY); @@ -213,11 +213,11 @@ screenshot_add_border (GdkPixbuf **src) { GdkPixbuf *dest; static ConvFilter *filter = NULL; - + if (!filter) filter = create_outline_filter (OUTLINE_RADIUS); - - dest = create_effect (*src, filter, + + dest = create_effect (*src, filter, OUTLINE_RADIUS, OUTLINE_OFFSET, OUTLINE_OPACITY); diff --git a/mate-screenshot/src/screenshot-xfer.c b/mate-screenshot/src/screenshot-xfer.c index eaf09121..a11131a7 100644 --- a/mate-screenshot/src/screenshot-xfer.c +++ b/mate-screenshot/src/screenshot-xfer.c @@ -73,7 +73,7 @@ do_run_overwrite_confirm_dialog (gpointer _data) gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), _("The file \"%s\" already exists. " - "Would you like to replace it?"), + "Would you like to replace it?"), data->basename); gtk_dialog_add_button (GTK_DIALOG (dialog), "gtk-cancel", @@ -86,7 +86,7 @@ do_run_overwrite_confirm_dialog (gpointer _data) gtk_widget_destroy (dialog); data->resp = response; - + return FALSE; } @@ -110,9 +110,9 @@ transfer_progress_dialog_new (TransferJob *job) TransferDialog *dialog; GtkWidget *gdialog; GtkWidget *widget; - + dialog = g_new0 (TransferDialog, 1); - + gdialog = gtk_message_dialog_new (GTK_WINDOW (job->parent), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_OTHER, @@ -124,7 +124,7 @@ transfer_progress_dialog_new (TransferJob *job) gtk_widget_show (widget); dialog->progress_bar = widget; dialog->dialog = gdialog; - + g_signal_connect (gdialog, "response", G_CALLBACK (transfer_dialog_response_cb), @@ -132,7 +132,7 @@ transfer_progress_dialog_new (TransferJob *job) job->dialog = dialog; gtk_widget_show (gdialog); - + return FALSE; } @@ -161,12 +161,12 @@ run_overwrite_confirm_dialog (TransferJob *job) data->basename = basename; need_timeout = (job->dialog_timeout_id > 0); - + if (need_timeout) { g_source_remove (job->dialog_timeout_id); job->dialog_timeout_id = 0; - } + } g_io_scheduler_job_send_to_mainloop (job->io_job, do_run_overwrite_confirm_dialog, @@ -176,11 +176,11 @@ run_overwrite_confirm_dialog (TransferJob *job) if (need_timeout) transfer_progress_dialog_start (job); - + g_free (basename); g_slice_free (ErrorDialogData, data); - return response; + return response; } static gboolean @@ -188,12 +188,12 @@ transfer_progress_dialog_update (TransferJob *job) { TransferDialog *dialog = job->dialog; double fraction; - + fraction = ((double) job->current_bytes) / ((double) job->total_bytes); gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (dialog->progress_bar), fraction); - + return FALSE; } @@ -202,9 +202,9 @@ transfer_job_done (gpointer user_data) { TransferJob *job = user_data; TransferDialog *dialog; - + dialog = job->dialog; - + if (job->dialog_timeout_id) { g_source_remove (job->dialog_timeout_id); @@ -212,14 +212,14 @@ transfer_job_done (gpointer user_data) } if (dialog) gtk_widget_destroy (dialog->dialog); - + if (job->callback) { (job->callback) (job->result, job->error, job->callback_data); } - + g_object_unref (job->source); g_object_unref (job->dest); g_object_unref (job->cancellable); @@ -227,7 +227,7 @@ transfer_job_done (gpointer user_data) g_free (dialog); g_free (job->error); g_slice_free (TransferJob, job); - + return FALSE; } @@ -235,12 +235,12 @@ static void transfer_progress_cb (goffset current_num_bytes, goffset total_num_bytes, TransferJob *job) -{ +{ job->current_bytes = current_num_bytes; if (!job->dialog) return; - + g_io_scheduler_job_send_to_mainloop_async (job->io_job, (GSourceFunc) transfer_progress_dialog_update, job, @@ -252,7 +252,7 @@ get_file_size (GFile *file) { GFileInfo *file_info; goffset size; - + file_info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_SIZE, 0, NULL, NULL); @@ -268,7 +268,7 @@ get_file_size (GFile *file) */ size = -1; } - + return size; } @@ -279,7 +279,7 @@ transfer_file (GIOSchedulerJob *io_job, { TransferJob *job = user_data; GError *error; - + job->io_job = io_job; job->total_bytes = get_file_size (job->source); if (job->total_bytes == -1) @@ -288,7 +288,7 @@ transfer_file (GIOSchedulerJob *io_job, error = NULL; job->result = TRANSFER_ERROR; job->error = g_strdup (_("Can't access source file")); - + goto out; } @@ -339,7 +339,7 @@ retry: g_cancellable_cancel (job->cancellable); job->result = TRANSFER_ERROR; job->error = g_strdup (error->message); - + goto out; } } @@ -347,18 +347,18 @@ retry: { /* success */ job->result = TRANSFER_OK; - + goto out; } out: if (error) g_error_free (error); - + g_io_scheduler_job_send_to_mainloop_async (io_job, transfer_job_done, job, - NULL); + NULL); return FALSE; } |