diff options
Diffstat (limited to 'plugins/housekeeping/msd-ldsm-dialog.c')
-rw-r--r-- | plugins/housekeeping/msd-ldsm-dialog.c | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/plugins/housekeeping/msd-ldsm-dialog.c b/plugins/housekeeping/msd-ldsm-dialog.c index d9b5cd5..f045550 100644 --- a/plugins/housekeeping/msd-ldsm-dialog.c +++ b/plugins/housekeeping/msd-ldsm-dialog.c @@ -2,17 +2,17 @@ * * msd-ldsm-dialog.c * Copyright (C) Chris Coulson 2009 <[email protected]> - * + * * msd-ldsm-dialog.c 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. - * + * * msd-ldsm-dialog.c 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/>. */ @@ -60,7 +60,7 @@ static const gchar* msd_ldsm_dialog_get_checkbutton_text (MsdLdsmDialog *dialog) { g_return_val_if_fail (MSD_IS_LDSM_DIALOG (dialog), NULL); - + if (dialog->priv->other_partitions) return _("Don't show any warnings again for this file system"); else @@ -71,11 +71,11 @@ static gchar* msd_ldsm_dialog_get_primary_text (MsdLdsmDialog *dialog) { gchar *primary_text, *free_space; - + g_return_val_if_fail (MSD_IS_LDSM_DIALOG (dialog), NULL); - + free_space = g_format_size (dialog->priv->space_remaining); - + if (dialog->priv->other_partitions) { primary_text = g_strdup_printf (_("The volume \"%s\" has only %s disk space remaining."), dialog->priv->partition_name, free_space); @@ -83,17 +83,17 @@ msd_ldsm_dialog_get_primary_text (MsdLdsmDialog *dialog) primary_text = g_strdup_printf (_("This computer has only %s disk space remaining."), free_space); } - + g_free (free_space); - - return primary_text; + + return primary_text; } static const gchar* msd_ldsm_dialog_get_secondary_text (MsdLdsmDialog *dialog) { g_return_val_if_fail (MSD_IS_LDSM_DIALOG (dialog), NULL); - + if (dialog->priv->other_usable_partitions) { if (dialog->priv->has_trash) { return _("You can free up disk space by emptying the Trash, removing " \ @@ -127,21 +127,21 @@ update_ignore_paths (GSList **ignore_paths, { GSList *found; gchar *path_to_remove; - + found = g_slist_find_custom (*ignore_paths, mount_path, (GCompareFunc) ignore_path_compare); - + if (ignore && (found == NULL)) { *ignore_paths = g_slist_prepend (*ignore_paths, g_strdup (mount_path)); return TRUE; } - + if (!ignore && (found != NULL)) { path_to_remove = found->data; *ignore_paths = g_slist_remove (*ignore_paths, path_to_remove); g_free (path_to_remove); return TRUE; } - + return FALSE; } @@ -170,8 +170,8 @@ ignore_check_button_toggled_cb (GtkToggleButton *button, ignore_paths = g_slist_reverse (ignore_paths); ignore = gtk_toggle_button_get_active (button); - updated = update_ignore_paths (&ignore_paths, dialog->priv->mount_path, ignore); - + updated = update_ignore_paths (&ignore_paths, dialog->priv->mount_path, ignore); + if (updated) { GSList *l; GPtrArray *array = g_ptr_array_new (); @@ -190,7 +190,7 @@ ignore_check_button_toggled_cb (GtkToggleButton *button, g_slist_foreach (ignore_paths, (GFunc) g_free, NULL); g_slist_free (ignore_paths); - g_object_unref (settings); + g_object_unref (settings); } static void @@ -198,14 +198,14 @@ msd_ldsm_dialog_init (MsdLdsmDialog *dialog) { GtkWidget *main_vbox, *text_vbox, *hbox; GtkWidget *image; - + dialog->priv = MSD_LDSM_DIALOG_GET_PRIVATE (dialog); - + main_vbox = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); /* Set up all the window stuff here */ gtk_window_set_title (GTK_WINDOW (dialog), _("Low Disk Space")); - gtk_window_set_icon_name (GTK_WINDOW (dialog), + gtk_window_set_icon_name (GTK_WINDOW (dialog), "dialog-warning"); gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER); @@ -219,13 +219,13 @@ msd_ldsm_dialog_init (MsdLdsmDialog *dialog) gtk_widget_set_valign (image, GTK_ALIGN_END); /* Create the labels */ - dialog->priv->primary_label = gtk_label_new (NULL); + dialog->priv->primary_label = gtk_label_new (NULL); gtk_label_set_line_wrap (GTK_LABEL (dialog->priv->primary_label), TRUE); gtk_label_set_single_line_mode (GTK_LABEL (dialog->priv->primary_label), FALSE); gtk_label_set_max_width_chars (GTK_LABEL (dialog->priv->primary_label), 70); gtk_label_set_xalign (GTK_LABEL (dialog->priv->primary_label), 0.0); gtk_label_set_yalign (GTK_LABEL (dialog->priv->primary_label), 0.0); - + dialog->priv->secondary_label = gtk_label_new (NULL); gtk_label_set_line_wrap (GTK_LABEL (dialog->priv->secondary_label), TRUE); gtk_label_set_single_line_mode (GTK_LABEL (dialog->priv->secondary_label), FALSE); @@ -242,26 +242,26 @@ msd_ldsm_dialog_init (MsdLdsmDialog *dialog) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->ignore_check_button), FALSE); g_signal_connect (dialog->priv->ignore_check_button, "toggled", G_CALLBACK (ignore_check_button_toggled_cb), dialog); - + /* Now set up the dialog's GtkBox's' */ gtk_box_set_spacing (GTK_BOX (main_vbox), 14); - + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); gtk_container_set_border_width (GTK_CONTAINER (hbox), 5); - + text_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); - + gtk_box_pack_start (GTK_BOX (text_vbox), dialog->priv->primary_label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (text_vbox), dialog->priv->secondary_label, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (text_vbox), dialog->priv->ignore_check_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), text_vbox, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (hbox), text_vbox, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0); - + /* Set up the action area */ gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dialog))), 6); gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_action_area (GTK_DIALOG (dialog))), 5); - + gtk_widget_show_all (hbox); } @@ -269,18 +269,18 @@ static void msd_ldsm_dialog_finalize (GObject *object) { MsdLdsmDialog *self; - + g_return_if_fail (object != NULL); g_return_if_fail (MSD_IS_LDSM_DIALOG (object)); self = MSD_LDSM_DIALOG (object); - + if (self->priv->partition_name) g_free (self->priv->partition_name); - + if (self->priv->mount_path) g_free (self->priv->mount_path); - + G_OBJECT_CLASS (msd_ldsm_dialog_parent_class)->finalize (object); } @@ -288,9 +288,9 @@ static void msd_ldsm_dialog_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { MsdLdsmDialog *self; - + g_return_if_fail (MSD_IS_LDSM_DIALOG (object)); - + self = MSD_LDSM_DIALOG (object); switch (prop_id) @@ -323,9 +323,9 @@ static void msd_ldsm_dialog_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { MsdLdsmDialog *self; - + g_return_if_fail (MSD_IS_LDSM_DIALOG (object)); - + self = MSD_LDSM_DIALOG (object); switch (prop_id) @@ -386,7 +386,7 @@ msd_ldsm_dialog_class_init (MsdLdsmDialogClass *klass) "Set to TRUE if the partition has files in it's trash folder that can be deleted", FALSE, G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); - + g_object_class_install_property (object_class, PROP_SPACE_REMAINING, g_param_spec_int64 ("space-remaining", @@ -394,7 +394,7 @@ msd_ldsm_dialog_class_init (MsdLdsmDialogClass *klass) "Specify how much space is remaining in bytes", G_MININT64, G_MAXINT64, 0, G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); - + g_object_class_install_property (object_class, PROP_PARTITION_NAME, g_param_spec_string ("partition-name", @@ -402,7 +402,7 @@ msd_ldsm_dialog_class_init (MsdLdsmDialogClass *klass) "Specify the name of the partition", "Unknown", G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); - + g_object_class_install_property (object_class, PROP_MOUNT_PATH, g_param_spec_string ("mount-path", @@ -428,7 +428,7 @@ msd_ldsm_dialog_new (gboolean other_usable_partitions, GtkWidget *empty_trash_image, *analyze_image, *ignore_image; gchar *primary_text, *primary_text_markup; const gchar *secondary_text, *checkbutton_text; - + dialog = MSD_LDSM_DIALOG (g_object_new (MSD_TYPE_LDSM_DIALOG, "other-usable-partitions", other_usable_partitions, "other-partitions", other_partitions, @@ -437,7 +437,7 @@ msd_ldsm_dialog_new (gboolean other_usable_partitions, "partition-name", partition_name, "mount-path", mount_path, NULL)); - + /* Add some buttons */ if (dialog->priv->has_trash) { button_empty_trash = gtk_dialog_add_button (GTK_DIALOG (dialog), @@ -446,7 +446,7 @@ msd_ldsm_dialog_new (gboolean other_usable_partitions, empty_trash_image = gtk_image_new_from_icon_name ("edit-clear", GTK_ICON_SIZE_BUTTON); gtk_button_set_image (GTK_BUTTON (button_empty_trash), empty_trash_image); } - + if (display_baobab) { button_analyze = gtk_dialog_add_button (GTK_DIALOG (dialog), _("Examine…"), @@ -454,28 +454,28 @@ msd_ldsm_dialog_new (gboolean other_usable_partitions, analyze_image = gtk_image_new_from_icon_name ("baobab", GTK_ICON_SIZE_BUTTON); gtk_button_set_image (GTK_BUTTON (button_analyze), analyze_image); } - - button_ignore = gtk_dialog_add_button (GTK_DIALOG (dialog), - _("Ignore"), + + button_ignore = gtk_dialog_add_button (GTK_DIALOG (dialog), + _("Ignore"), GTK_RESPONSE_CANCEL); ignore_image = gtk_image_new_from_stock (GTK_STOCK_CANCEL, GTK_ICON_SIZE_BUTTON); gtk_button_set_image (GTK_BUTTON (button_ignore), ignore_image); - + gtk_widget_grab_default (button_ignore); - - /* Set the label text */ + + /* Set the label text */ primary_text = msd_ldsm_dialog_get_primary_text (dialog); primary_text_markup = g_markup_printf_escaped ("<big><b>%s</b></big>", primary_text); gtk_label_set_markup (GTK_LABEL (dialog->priv->primary_label), primary_text_markup); secondary_text = msd_ldsm_dialog_get_secondary_text (dialog); gtk_label_set_text (GTK_LABEL (dialog->priv->secondary_label), secondary_text); - + checkbutton_text = msd_ldsm_dialog_get_checkbutton_text (dialog); gtk_button_set_label (GTK_BUTTON (dialog->priv->ignore_check_button), checkbutton_text); - + g_free (primary_text); g_free (primary_text_markup); - + return dialog; -} +} |