aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2001-07-01 17:10:36 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2001-07-01 17:10:36 +0800
commit2990822b331d03ae98a2dbbc5fe07622aba5f005 (patch)
treeb04990e37ae2d93f56fc9cf5572596fc621c5137
parent8b6c94e7cd38d3ee58fe9dfeb0d3ffd03eefd6cb (diff)
downloadgsoc2013-evolution-2990822b331d03ae98a2dbbc5fe07622aba5f005.tar.gz
gsoc2013-evolution-2990822b331d03ae98a2dbbc5fe07622aba5f005.tar.zst
gsoc2013-evolution-2990822b331d03ae98a2dbbc5fe07622aba5f005.zip
Implemented the `File -> New -> Shortcut' command.
I have also implemented a "no-new-button" mode for the folder selection dialog widget. svn path=/trunk/; revision=10655
-rw-r--r--shell/ChangeLog16
-rw-r--r--shell/e-shell-folder-selection-dialog.c53
-rw-r--r--shell/e-shell-folder-selection-dialog.h4
-rw-r--r--shell/e-shell-view-menu.c91
-rw-r--r--ui/ChangeLog4
-rw-r--r--ui/evolution.xml2
6 files changed, 155 insertions, 15 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index eed8f838fc..98a719d656 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,5 +1,21 @@
2001-07-01 Ettore Perazzoli <ettore@ximian.com>
+ * e-shell-view-menu.c (command_new_shortcut): New, implementation
+ for the "New Shortcut" command create a new shortcut.
+ (goto_folder_dialog_cancelled_cb): Renamed from
+ `folder_selection_dialog_cancelled_callback'.
+ (goto_folder_dialog_folder_selected_cb): Renamed from
+ `folder_selection_dialog_cancelled_callback'.
+
+ * e-shell-folder-selection-dialog.c: New member `allow_creation'
+ in `EShellFolderSelectionDialogPrivate'.
+ (e_shell_folder_selection_dialog_get_allow_creation): New; return
+ the value of `allow_creation'.
+ (e_shell_folder_selection_dialog_set_allow_creation): New; hide or
+ show the "New" button according to the @allow_creation arg.
+
+2001-07-01 Ettore Perazzoli <ettore@ximian.com>
+
* e-shortcuts-view.c: Added "Rename Group" command to the
right-click group menu item.
(rename_group_cb): New callback for the "Rename Group" command.
diff --git a/shell/e-shell-folder-selection-dialog.c b/shell/e-shell-folder-selection-dialog.c
index 0096462ab7..8ef598c50b 100644
--- a/shell/e-shell-folder-selection-dialog.c
+++ b/shell/e-shell-folder-selection-dialog.c
@@ -50,6 +50,8 @@ struct _EShellFolderSelectionDialogPrivate {
GList *allowed_types;
EStorageSet *storage_set;
GtkWidget *storage_set_view;
+
+ gboolean allow_creation;
};
enum {
@@ -252,6 +254,7 @@ init (EShellFolderSelectionDialog *shell_folder_selection_dialog)
priv->storage_set = NULL;
priv->storage_set_view = NULL;
priv->allowed_types = NULL;
+ priv->allow_creation = TRUE;
shell_folder_selection_dialog->priv = priv;
}
@@ -426,6 +429,56 @@ e_shell_folder_selection_dialog_new (EShell *shell,
}
+/**
+ * e_shell_folder_selection_dialog_set_allow_creation:
+ * @folder_selection_dialog: An EShellFolderSelectionDialog widget
+ * @allow_creation: Boolean specifying whether the "New..." button should be
+ * displayed
+ *
+ * Specify whether @folder_selection_dialog should have a "New..." button to
+ * create a new folder or not.
+ **/
+void
+e_shell_folder_selection_dialog_set_allow_creation (EShellFolderSelectionDialog *folder_selection_dialog,
+ gboolean allow_creation)
+{
+ GList *button_list_item;
+ GtkWidget *button;
+
+ g_return_if_fail (folder_selection_dialog != NULL);
+ g_return_if_fail (E_IS_SHELL_FOLDER_SELECTION_DIALOG (folder_selection_dialog));
+
+ folder_selection_dialog->priv->allow_creation = !! allow_creation;
+
+ button_list_item = g_list_nth (GNOME_DIALOG (folder_selection_dialog)->buttons, 2);
+ g_assert (button_list_item != NULL);
+
+ button = GTK_WIDGET (button_list_item->data);
+
+ if (allow_creation)
+ gtk_widget_show (button);
+ else
+ gtk_widget_hide (button);
+}
+
+/**
+ * e_shell_folder_selection_dialog_get_allow_creation:
+ * @folder_selection_dialog: An EShellFolderSelectionDialog widget
+ *
+ * Get whether the "New..." button is displayed.
+ *
+ * Return value: %TRUE if the "New..." button is displayed, %FALSE otherwise.
+ **/
+gboolean
+e_shell_folder_selection_dialog_get_allow_creation (EShellFolderSelectionDialog *folder_selection_dialog)
+{
+ g_return_val_if_fail (folder_selection_dialog != NULL, FALSE);
+ g_return_val_if_fail (E_IS_SHELL_FOLDER_SELECTION_DIALOG (folder_selection_dialog), FALSE);
+
+ return folder_selection_dialog->priv->allow_creation;
+}
+
+
const char *
e_shell_folder_selection_dialog_get_selected_path (EShellFolderSelectionDialog *folder_selection_dialog)
{
diff --git a/shell/e-shell-folder-selection-dialog.h b/shell/e-shell-folder-selection-dialog.h
index cf0de808d2..7cf2ec259e 100644
--- a/shell/e-shell-folder-selection-dialog.h
+++ b/shell/e-shell-folder-selection-dialog.h
@@ -72,6 +72,10 @@ GtkWidget *e_shell_folder_selection_dialog_new (EShell
const char *default_uri,
const char *allowed_types[]);
+void e_shell_folder_selection_dialog_set_allow_creation (EShellFolderSelectionDialog *folder_selection_dialog,
+ gboolean allow_creation);
+gboolean e_shell_folder_selection_dialog_get_allow_creation (EShellFolderSelectionDialog *folder_selection_dialog);
+
const char *e_shell_folder_selection_dialog_get_selected_path (EShellFolderSelectionDialog *folder_selection_dialog);
#ifdef cplusplus
diff --git a/shell/e-shell-view-menu.c b/shell/e-shell-view-menu.c
index d141e43662..7e5bef44b1 100644
--- a/shell/e-shell-view-menu.c
+++ b/shell/e-shell-view-menu.c
@@ -422,20 +422,16 @@ command_folder_properties (BonoboUIComponent *uih,
/* Going to a folder. */
static void
-folder_selection_dialog_cancelled_cb (EShellFolderSelectionDialog *folder_selection_dialog,
- void *data)
+goto_folder_dialog_cancelled_cb (EShellFolderSelectionDialog *folder_selection_dialog,
+ void *data)
{
- EShellView *shell_view;
-
- shell_view = E_SHELL_VIEW (data);
-
gtk_widget_destroy (GTK_WIDGET (folder_selection_dialog));
}
static void
-folder_selection_dialog_folder_selected_cb (EShellFolderSelectionDialog *folder_selection_dialog,
- const char *path,
- void *data)
+goto_folder_dialog_folder_selected_cb (EShellFolderSelectionDialog *folder_selection_dialog,
+ const char *path,
+ void *data)
{
if (path != NULL) {
EShellView *shell_view;
@@ -472,10 +468,10 @@ command_goto_folder (BonoboUIComponent *uih,
gtk_window_set_transient_for (GTK_WINDOW (folder_selection_dialog), GTK_WINDOW (shell_view));
- gtk_signal_connect (GTK_OBJECT (folder_selection_dialog), "folder_selected",
- GTK_SIGNAL_FUNC (folder_selection_dialog_folder_selected_cb), shell_view);
gtk_signal_connect (GTK_OBJECT (folder_selection_dialog), "cancelled",
- GTK_SIGNAL_FUNC (folder_selection_dialog_cancelled_cb), shell_view);
+ GTK_SIGNAL_FUNC (goto_folder_dialog_cancelled_cb), shell_view);
+ gtk_signal_connect (GTK_OBJECT (folder_selection_dialog), "folder_selected",
+ GTK_SIGNAL_FUNC (goto_folder_dialog_folder_selected_cb), shell_view);
gtk_widget_show (folder_selection_dialog);
}
@@ -556,9 +552,76 @@ command_new_mail_message (BonoboUIComponent *uih,
CORBA_exception_free (&ev);
}
-
-DEFINE_UNIMPLEMENTED (command_new_shortcut)
+
+static void
+new_shortcut_dialog_cancelled_cb (EShellFolderSelectionDialog *folder_selection_dialog,
+ void *data)
+{
+ gtk_widget_destroy (GTK_WIDGET (folder_selection_dialog));
+}
+
+static void
+new_shortcut_dialog_folder_selected_cb (EShellFolderSelectionDialog *folder_selection_dialog,
+ const char *path,
+ void *data)
+{
+ EShellView *shell_view;
+ EShell *shell;
+ EShortcuts *shortcuts;
+ EFolder *folder;
+ int group_num;
+ char *evolution_uri;
+
+ if (path == NULL)
+ return;
+
+ shell_view = E_SHELL_VIEW (data);
+ shell = e_shell_view_get_shell (shell_view);
+ shortcuts = e_shell_get_shortcuts (shell);
+
+ folder = e_storage_set_get_folder (e_shell_get_storage_set (shell), path);
+ if (folder == NULL)
+ return;
+
+ group_num = e_shell_view_get_current_shortcuts_group_num (shell_view);
+
+ evolution_uri = g_strconcat (E_SHELL_URI_PREFIX, path, NULL);
+
+ /* FIXME: I shouldn't have to set the type here. Maybe. */
+ e_shortcuts_add_shortcut (shortcuts, group_num, -1, evolution_uri, NULL, e_folder_get_type_string (folder));
+
+ g_free (evolution_uri);
+
+ gtk_widget_destroy (GTK_WIDGET (folder_selection_dialog));
+}
+
+static void
+command_new_shortcut (BonoboUIComponent *uih,
+ void *data,
+ const char *path)
+{
+ EShellView *shell_view;
+ GtkWidget *folder_selection_dialog;
+
+ shell_view = E_SHELL_VIEW (data);
+
+ folder_selection_dialog = e_shell_folder_selection_dialog_new (e_shell_view_get_shell (shell_view),
+ _("Create a new shortcut"),
+ _("Select the folder you want the shortcut to point to:"),
+ e_shell_view_get_current_uri (shell_view),
+ NULL);
+ e_shell_folder_selection_dialog_set_allow_creation (E_SHELL_FOLDER_SELECTION_DIALOG (folder_selection_dialog),
+ FALSE);
+
+ gtk_signal_connect (GTK_OBJECT (folder_selection_dialog), "cancelled",
+ GTK_SIGNAL_FUNC (new_shortcut_dialog_cancelled_cb), shell_view);
+ gtk_signal_connect (GTK_OBJECT (folder_selection_dialog), "folder_selected",
+ GTK_SIGNAL_FUNC (new_shortcut_dialog_folder_selected_cb), shell_view);
+
+ gtk_widget_show (folder_selection_dialog);
+}
+
DEFINE_UNIMPLEMENTED (command_new_contact)
DEFINE_UNIMPLEMENTED (command_new_task_request)
diff --git a/ui/ChangeLog b/ui/ChangeLog
index d3e273e060..5422a9100a 100644
--- a/ui/ChangeLog
+++ b/ui/ChangeLog
@@ -1,3 +1,7 @@
+2001-07-01 Ettore Perazzoli <ettore@ximian.com>
+
+ * evolution.xml: Renamed "NewBarShortcut" verb into "NewShortcut".
+
2001-06-30 Ettore Perazzoli <ettore@ximian.com>
* evolution-mail-message.xml: Change type of "MailPrevious" and
diff --git a/ui/evolution.xml b/ui/evolution.xml
index 98c7a2e219..f013f76998 100644
--- a/ui/evolution.xml
+++ b/ui/evolution.xml
@@ -44,7 +44,7 @@
accel="*Control**Shift*e"
pixtype="pixbuf"/>
- <menuitem name="Shortcut" verb="NewBarShortcut"
+ <menuitem name="Shortcut" verb="NewShortcut"
_label="Evolution bar _shortcut"
accel="*Control**Shift*s"/>