[dia/zbrown/remove-non-integrated-ui] It's now impossible to be a standalone window
- From: Zander <zbrown src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia/zbrown/remove-non-integrated-ui] It's now impossible to be a standalone window
- Date: Mon, 28 Jan 2019 18:15:13 +0000 (UTC)
commit 184c98abe382d40f5cd30e25ab7acf6fbe6b21a4
Author: Zander Brown <zbrown gnome org>
Date: Mon Jan 28 17:56:21 2019 +0000
It's now impossible to be a standalone window
app/display.c | 117 +++++++++++++++++++++++---------------------------------
app/display.h | 4 --
app/interface.c | 2 -
3 files changed, 47 insertions(+), 76 deletions(-)
---
diff --git a/app/display.c b/app/display.c
index 6238d377..629954d6 100644
--- a/app/display.c
+++ b/app/display.c
@@ -1193,13 +1193,8 @@ ddisp_destroy(DDisplay *ddisp)
gtk_window_set_transient_for(GTK_WINDOW(interface_get_toolbox_shell()), NULL);
}
- /* This calls ddisplay_really_destroy */
- if (ddisp->is_standalone_window)
- gtk_widget_destroy (ddisp->shell);
- else {
- gtk_widget_destroy (ddisp->container);
- ddisplay_really_destroy (ddisp);
- }
+ gtk_widget_destroy (ddisp->container);
+ ddisplay_really_destroy (ddisp);
}
static void
@@ -1395,37 +1390,32 @@ ddisplay_really_destroy(DDisplay *ddisp)
void
ddisplay_set_title(DDisplay *ddisp, char *title)
{
- if (ddisp->is_standalone_window)
- gtk_window_set_title (GTK_WINDOW (ddisp->shell), title);
- else
+ GtkNotebook *notebook = g_object_get_data (G_OBJECT (ddisp->shell),
+ DIA_MAIN_NOTEBOOK);
+ /* Find the page with ddisp then set the label on the tab */
+ gint num_pages = gtk_notebook_get_n_pages (notebook);
+ gint num;
+ GtkWidget *page;
+ for (num = 0 ; num < num_pages ; num++)
{
- GtkNotebook *notebook = g_object_get_data (G_OBJECT (ddisp->shell),
- DIA_MAIN_NOTEBOOK);
- /* Find the page with ddisp then set the label on the tab */
- gint num_pages = gtk_notebook_get_n_pages (notebook);
- gint num;
- GtkWidget *page;
- for (num = 0 ; num < num_pages ; num++)
- {
- page = gtk_notebook_get_nth_page (notebook,num);
- if (g_object_get_data (G_OBJECT (page), "DDisplay") == ddisp)
- {
- GtkLabel *label = g_object_get_data (G_OBJECT (page), "tab-label");
- /* not using the passed in title here, because it may be too long */
- gchar *name = diagram_get_name(ddisp->diagram);
- gtk_label_set_text(label,name);
- g_free(name);
- break;
- }
- }
- /* now modify the application window title */
+ page = gtk_notebook_get_nth_page (notebook,num);
+ if (g_object_get_data (G_OBJECT (page), "DDisplay") == ddisp)
{
- const gchar *pname = g_get_prgname();
- gchar *fulltitle = g_strdup_printf ("%s - %s", title, pname ? pname : "Dia");
- gtk_window_set_title (GTK_WINDOW (ddisp->shell), fulltitle);
- g_free(fulltitle);
+ GtkLabel *label = g_object_get_data (G_OBJECT (page), "tab-label");
+ /* not using the passed in title here, because it may be too long */
+ gchar *name = diagram_get_name(ddisp->diagram);
+ gtk_label_set_text(label,name);
+ g_free(name);
+ break;
}
}
+ /* now modify the application window title */
+ {
+ const gchar *pname = g_get_prgname();
+ gchar *fulltitle = g_strdup_printf ("%s - %s", title, pname ? pname : "Dia");
+ gtk_window_set_title (GTK_WINDOW (ddisp->shell), fulltitle);
+ g_free(fulltitle);
+ }
}
void
@@ -1544,50 +1534,37 @@ display_set_active(DDisplay *ddisp)
diagram_properties_set_diagram(ddisp ? ddisp->diagram : NULL);
if (ddisp) {
- if (ddisp->is_standalone_window)
+ GtkNotebook *notebook = g_object_get_data (G_OBJECT (ddisp->shell),
+ DIA_MAIN_NOTEBOOK);
+ /* Find the page with ddisp then set the label on the tab */
+ gint num_pages = gtk_notebook_get_n_pages (notebook);
+ gint num;
+ GtkWidget *page;
+ for (num = 0 ; num < num_pages ; num++)
{
- display_update_menu_state(ddisp);
-
- if (prefs.toolbox_on_top) {
- gtk_window_set_transient_for(GTK_WINDOW(interface_get_toolbox_shell()),
- GTK_WINDOW(ddisp->shell));
- } else {
- gtk_window_set_transient_for(GTK_WINDOW(interface_get_toolbox_shell()),
- NULL);
- }
- } else {
- GtkNotebook *notebook = g_object_get_data (G_OBJECT (ddisp->shell),
- DIA_MAIN_NOTEBOOK);
- /* Find the page with ddisp then set the label on the tab */
- gint num_pages = gtk_notebook_get_n_pages (notebook);
- gint num;
- GtkWidget *page;
- for (num = 0 ; num < num_pages ; num++)
+ page = gtk_notebook_get_nth_page (notebook,num);
+ if (g_object_get_data (G_OBJECT (page), "DDisplay") == ddisp)
{
- page = gtk_notebook_get_nth_page (notebook,num);
- if (g_object_get_data (G_OBJECT (page), "DDisplay") == ddisp)
- {
- gtk_notebook_set_current_page (notebook,num);
- break;
- }
+ gtk_notebook_set_current_page (notebook,num);
+ break;
}
- /* synchronize_ui_to_active_display (ddisp); */
- /* updates display title, etc */
- diagram_modified(ddisp->diagram);
+ }
+ /* synchronize_ui_to_active_display (ddisp); */
+ /* updates display title, etc */
+ diagram_modified(ddisp->diagram);
- /* ZOOM */
- update_zoom_status (ddisp);
+ /* ZOOM */
+ update_zoom_status (ddisp);
- /* Snap to grid */
- ddisplay_set_snap_to_grid (ddisp, ddisp->grid.snap); /* menus */
+ /* Snap to grid */
+ ddisplay_set_snap_to_grid (ddisp, ddisp->grid.snap); /* menus */
- /* Object snapping */
- ddisplay_set_snap_to_objects (ddisp, ddisp->mainpoint_magnetism);
+ /* Object snapping */
+ ddisplay_set_snap_to_objects (ddisp, ddisp->mainpoint_magnetism);
- display_update_menu_state (ddisp);
+ display_update_menu_state (ddisp);
- gtk_window_present (GTK_WINDOW(ddisp->shell));
- }
+ gtk_window_present (GTK_WINDOW(ddisp->shell));
}
}
}
diff --git a/app/display.h b/app/display.h
index 2fef0f05..9b773be5 100644
--- a/app/display.h
+++ b/app/display.h
@@ -92,10 +92,6 @@ struct _DDisplay {
gchar *preedit_string;
PangoAttrList *preedit_attrs;
- /* Is there another case? Like I see embedded-dia modules, do these do something
- * in addition??? */
- gboolean is_standalone_window;
-
/* Points to Integrated UI Toolbar */
GtkToolbar *common_toolbar;
diff --git a/app/interface.c b/app/interface.c
index c800302c..2dcb42bb 100644
--- a/app/interface.c
+++ b/app/interface.c
@@ -528,8 +528,6 @@ use_integrated_ui_for_display_shell(DDisplay *ddisp, char *title)
GtkRcStyle *rcstyle;
gint notebook_page_index;
- ddisp->is_standalone_window = FALSE;
-
ddisp->shell = GTK_WIDGET (ui.main_window);
ddisp->modified_status = GTK_WIDGET (ui.statusbar);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]