implement removing of controllers, confirmed by a dialog.

2005-05-13  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpcontrollerlist.c
	(gimp_controller_list_remove_clicked): implement removing of
	controllers, confirmed by a dialog.

	* app/widgets/gimpcontrollereditor.c
	(gimp_controller_editor_edit_clicked): set an alternative button
	order for the event mapping dialog.
This commit is contained in:
Michael Natterer 2005-05-12 22:00:17 +00:00 committed by Michael Natterer
parent af8320ea63
commit 8403515bd2
3 changed files with 86 additions and 1 deletions

View File

@ -1,3 +1,13 @@
2005-05-13 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpcontrollerlist.c
(gimp_controller_list_remove_clicked): implement removing of
controllers, confirmed by a dialog.
* app/widgets/gimpcontrollereditor.c
(gimp_controller_editor_edit_clicked): set an alternative button
order for the event mapping dialog.
2005-05-12 Simon Budig <simon@gimp.org>
* app/tools/gimpvectortool.c: reset the vector tool to Design

View File

@ -695,6 +695,11 @@ gimp_controller_editor_edit_clicked (GtkWidget *button,
NULL);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (editor->edit_dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
g_object_add_weak_pointer (G_OBJECT (editor->edit_dialog),
(gpointer) &editor->edit_dialog);

View File

@ -45,6 +45,7 @@
#include "gimpcontrollers.h"
#include "gimpdialogfactory.h"
#include "gimphelp-ids.h"
#include "gimpmessagedialog.c"
#include "gimppropwidgets.h"
#include "gimpuimanager.h"
#include "gimpviewabledialog.h"
@ -540,7 +541,76 @@ static void
gimp_controller_list_remove_clicked (GtkWidget *button,
GimpControllerList *list)
{
g_message ("TODO: implement remove");
GtkWidget *dialog;
gchar *primary;
gchar *secondary;
#define RESPONSE_DISABLE 1
dialog = gimp_message_dialog_new (_("Remove Controller?"),
GIMP_STOCK_WARNING,
GTK_WIDGET (list), GTK_DIALOG_MODAL,
NULL, NULL,
_("Disable Controller"), RESPONSE_DISABLE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
_("Remove Controller"), GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
RESPONSE_DISABLE,
-1);
primary =
g_strdup_printf (_("Remove Controller '%s'?"),
gimp_object_get_name (GIMP_OBJECT (list->dest_info)));
secondary =
g_strdup_printf (_("Removing this controller from the list of "
"active controllers will permanently delete "
"all event mappings you have configured.\n\n"
"Selecting \"Disable Controller\" will disable "
"the controller without removing it."));
gimp_message_box_set_primary_text (GIMP_MESSAGE_DIALOG (dialog)->box,
primary);
gimp_message_box_set_text (GIMP_MESSAGE_DIALOG (dialog)->box,
secondary);
g_free (primary);
g_free (secondary);
switch (gimp_dialog_run (GIMP_DIALOG (dialog)))
{
case RESPONSE_DISABLE:
gimp_controller_info_set_enabled (list->dest_info, FALSE);
break;
case GTK_RESPONSE_OK:
{
GtkWidget *editor_dialog;
GimpContainer *container;
editor_dialog = g_object_get_data (G_OBJECT (list->dest_info),
"gimp-controller-editor-dialog");
if (editor_dialog)
gtk_dialog_response (GTK_DIALOG (editor_dialog),
GTK_RESPONSE_DELETE_EVENT);
container = gimp_controllers_get_list (list->gimp);
gimp_container_remove (container, GIMP_OBJECT (list->dest_info));
}
break;
default:
break;
}
gtk_widget_destroy (dialog);
}
static void