mirror of
https://gitlab.gnome.org/GNOME/glade.git
synced 2025-10-16 00:04:58 -04:00
When selection changes, change the current project
to the one of the new selection.
This commit is contained in:
parent
9732223cd0
commit
29a72559c6
10
ChangeLog
10
ChangeLog
@ -1,9 +1,15 @@
|
||||
2003-06-21 Paolo Borelli <pborelli@katamail.com>
|
||||
|
||||
* src/glade-placeholder.c: fix return values for mouse
|
||||
events callbacks.
|
||||
* src/glade-project-window.[ch]: when selecting a widget
|
||||
of another project the current project change.
|
||||
* src/glade-widget.c: remove unused var.
|
||||
|
||||
2003-06-21 Joaquin Cuenca Abela <e98cuenc@yahoo.com>
|
||||
|
||||
* src/glade-placeholder.c: remove unused function.
|
||||
|
||||
* src/glade-utils.c: fix indentation and such.
|
||||
|
||||
* src/glade-widget.c: remove unused function.
|
||||
|
||||
2003-06-21 Joaquin Cuenca Abela <e98cuenc@yahoo.com>
|
||||
|
@ -159,7 +159,7 @@ glade_placeholder_add_methods_to_class (GladeWidgetClass *class)
|
||||
class->placeholder_replace = glade_placeholder_replace_container;
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
glade_placeholder_on_button_press_event (GladePlaceholder *placeholder,
|
||||
GdkEventButton *event,
|
||||
gpointer not_used)
|
||||
@ -167,25 +167,26 @@ glade_placeholder_on_button_press_event (GladePlaceholder *placeholder,
|
||||
GladeProjectWindow *gpw = glade_project_window_get ();
|
||||
|
||||
if (event->button == 1 && event->type == GDK_BUTTON_PRESS) {
|
||||
|
||||
if (gpw->add_class != NULL) {
|
||||
/*
|
||||
* A widget type is selected in the palette.
|
||||
/* A widget type is selected in the palette.
|
||||
* Add a new widget of that type.
|
||||
*/
|
||||
glade_command_create (gpw->add_class, placeholder, NULL);
|
||||
glade_project_window_set_add_class (gpw, NULL);
|
||||
} else {
|
||||
/* else set the current placeholder as selected */
|
||||
glade_project_selection_set (gpw->project, placeholder, FALSE);
|
||||
GladeWidget *parent = glade_placeholder_get_parent (placeholder);
|
||||
glade_project_selection_set (parent->project, placeholder, TRUE);
|
||||
}
|
||||
} else if (event->button == 3) {
|
||||
} else if (event->button == 3)
|
||||
glade_popup_placeholder_pop (placeholder, event);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
glade_placeholder_on_motion_notify_event (GladePlaceholder *placeholder, GdkEventMotion *event, gpointer not_used)
|
||||
static gboolean
|
||||
glade_placeholder_on_motion_notify_event (GladePlaceholder *placeholder,
|
||||
GdkEventMotion *event,
|
||||
gpointer not_used)
|
||||
{
|
||||
GladeProjectWindow *gpw;
|
||||
|
||||
@ -195,6 +196,8 @@ glade_placeholder_on_motion_notify_event (GladePlaceholder *placeholder, GdkEven
|
||||
glade_cursor_set (event->window, GLADE_CURSOR_SELECTOR);
|
||||
else
|
||||
glade_cursor_set (event->window, GLADE_CURSOR_ADD_WIDGET);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -1076,26 +1076,6 @@ glade_project_window_new (GList *catalogs)
|
||||
return gpw;
|
||||
}
|
||||
|
||||
static void
|
||||
glade_project_window_selection_changed_cb (GladeProject *project,
|
||||
GladeProjectWindow *gpw)
|
||||
{
|
||||
GList *list;
|
||||
gint num;
|
||||
|
||||
g_return_if_fail (GLADE_IS_PROJECT (project));
|
||||
g_return_if_fail (GLADE_IS_PROJECT_WINDOW (gpw));
|
||||
|
||||
if (gpw->editor) {
|
||||
list = glade_project_selection_get (project);
|
||||
num = g_list_length (list);
|
||||
if (num == 1 && !GLADE_IS_PLACEHOLDER (list->data))
|
||||
glade_editor_load_widget (gpw->editor, glade_widget_get_from_gtk_widget (GTK_WIDGET (list->data)));
|
||||
else
|
||||
glade_editor_load_widget (gpw->editor, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
glade_project_window_set_project (GladeProject *project)
|
||||
{
|
||||
@ -1107,12 +1087,19 @@ glade_project_window_set_project (GladeProject *project)
|
||||
|
||||
gpw = glade_project_window_get ();
|
||||
|
||||
if (gpw->project == project)
|
||||
return;
|
||||
|
||||
if (g_list_find (gpw->projects, project) == NULL) {
|
||||
g_warning ("Could not set project because it could not "
|
||||
" be found in the gpw->project list\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* clear the selection in the previous project */
|
||||
if (gpw->project)
|
||||
glade_project_selection_clear (gpw->project, FALSE);
|
||||
|
||||
gpw->project = project;
|
||||
gpw_refresh_title (gpw);
|
||||
|
||||
@ -1122,11 +1109,7 @@ glade_project_window_set_project (GladeProject *project)
|
||||
glade_project_view_set_project (view, project);
|
||||
}
|
||||
|
||||
gpw->project_selection_changed_signal =
|
||||
g_signal_connect (G_OBJECT (project), "selection_changed",
|
||||
G_CALLBACK (glade_project_window_selection_changed_cb),
|
||||
gpw);
|
||||
|
||||
/* trigger the selection changed signal to update the editor */
|
||||
glade_project_selection_changed (project);
|
||||
}
|
||||
|
||||
@ -1136,6 +1119,31 @@ gpw_widget_name_changed_cb (GladeProject *project, GladeWidget *widget, GladeEdi
|
||||
glade_editor_update_widget_name (editor);
|
||||
}
|
||||
|
||||
static void
|
||||
gpw_project_selection_changed_cb (GladeProject *project,
|
||||
GladeProjectWindow *gpw)
|
||||
{
|
||||
GList *list;
|
||||
gint num;
|
||||
|
||||
g_return_if_fail (GLADE_IS_PROJECT (project));
|
||||
g_return_if_fail (GLADE_IS_PROJECT_WINDOW (gpw));
|
||||
|
||||
if (gpw->project != project) {
|
||||
glade_project_window_set_project (project);
|
||||
return;
|
||||
}
|
||||
|
||||
if (gpw->editor) {
|
||||
list = glade_project_selection_get (project);
|
||||
num = g_list_length (list);
|
||||
if (num == 1 && !GLADE_IS_PLACEHOLDER (list->data))
|
||||
glade_editor_load_widget (gpw->editor, glade_widget_get_from_gtk_widget (GTK_WIDGET (list->data)));
|
||||
else
|
||||
glade_editor_load_widget (gpw->editor, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
glade_project_window_add_project (GladeProject *project)
|
||||
{
|
||||
@ -1175,11 +1183,12 @@ glade_project_window_add_project (GladeProject *project)
|
||||
|
||||
gtk_item_factory_create_item (gpw->item_factory, &(project->entry), project, 1);
|
||||
|
||||
/* connect the widget_changed_name signal to the editor, so that changes to the widget
|
||||
* name external to the properties editor (as when the user undo a widget name change)
|
||||
* are reflected on the widget name entry */
|
||||
/* connect to the project signals so that the editor can be updated */
|
||||
g_signal_connect (G_OBJECT (project), "widget_name_changed",
|
||||
G_CALLBACK (gpw_widget_name_changed_cb), gpw->editor);
|
||||
g_signal_connect (G_OBJECT (project), "selection_changed",
|
||||
G_CALLBACK (gpw_project_selection_changed_cb), gpw);
|
||||
|
||||
|
||||
glade_project_window_set_project (project);
|
||||
}
|
||||
|
@ -44,8 +44,6 @@ struct _GladeProjectWindow
|
||||
|
||||
GList *views; /* A list of GladeProjectView item */
|
||||
GList *projects; /* The list of Projects */
|
||||
|
||||
guint project_selection_changed_signal;
|
||||
};
|
||||
|
||||
|
||||
|
@ -352,7 +352,8 @@ glade_project_selection_clear (GladeProject *project, gboolean emit_signal)
|
||||
}
|
||||
|
||||
void
|
||||
glade_project_selection_remove (GladeProject *project, GtkWidget *widget,
|
||||
glade_project_selection_remove (GladeProject *project,
|
||||
GtkWidget *widget,
|
||||
gboolean emit_signal)
|
||||
{
|
||||
if (!glade_util_has_nodes (widget))
|
||||
@ -360,8 +361,7 @@ glade_project_selection_remove (GladeProject *project, GtkWidget *widget,
|
||||
|
||||
glade_util_remove_nodes (widget);
|
||||
|
||||
if (project)
|
||||
{
|
||||
if (project) {
|
||||
project->selection = g_list_remove (project->selection, widget);
|
||||
|
||||
if (emit_signal)
|
||||
@ -370,7 +370,8 @@ glade_project_selection_remove (GladeProject *project, GtkWidget *widget,
|
||||
}
|
||||
|
||||
void
|
||||
glade_project_selection_add (GladeProject *project, GtkWidget *widget,
|
||||
glade_project_selection_add (GladeProject *project,
|
||||
GtkWidget *widget,
|
||||
gboolean emit_signal)
|
||||
{
|
||||
if (glade_util_has_nodes (widget))
|
||||
@ -378,8 +379,7 @@ glade_project_selection_add (GladeProject *project, GtkWidget *widget,
|
||||
|
||||
glade_util_add_nodes (widget);
|
||||
|
||||
if (project)
|
||||
{
|
||||
if (project) {
|
||||
project->selection = g_list_prepend (project->selection, widget);
|
||||
|
||||
if (emit_signal)
|
||||
@ -388,7 +388,8 @@ glade_project_selection_add (GladeProject *project, GtkWidget *widget,
|
||||
}
|
||||
|
||||
void
|
||||
glade_project_selection_set (GladeProject *project, GtkWidget *widget,
|
||||
glade_project_selection_set (GladeProject *project,
|
||||
GtkWidget *widget,
|
||||
gboolean emit_signal)
|
||||
{
|
||||
if (glade_util_has_nodes (widget))
|
||||
|
@ -280,7 +280,6 @@ glade_widget_button_press (GtkWidget *event_widget,
|
||||
GdkEventButton *event,
|
||||
gpointer not_used)
|
||||
{
|
||||
GladeProjectWindow *gpw;
|
||||
GladeWidget *glade_widget;
|
||||
|
||||
glade_widget = glade_widget_get_from_event_widget (event_widget, event);
|
||||
@ -309,8 +308,6 @@ glade_widget_button_press (GtkWidget *event_widget,
|
||||
|
||||
g_debug(("The widget found was a %s\n", glade_widget->class->name));
|
||||
|
||||
gpw = glade_project_window_get ();
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user