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
This commit is contained in:
Ettore Perazzoli
2001-07-01 09:10:36 +00:00
parent 8b6c94e7cd
commit 2990822b33
6 changed files with 155 additions and 15 deletions

View File

@ -1,3 +1,19 @@
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

View File

@ -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;
}
@ -425,6 +428,56 @@ e_shell_folder_selection_dialog_new (EShell *shell,
return GTK_WIDGET (folder_selection_dialog);
}
/**
* 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)

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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"/>