From 16137d0d50c4e11473fdfb1159f45e6dcc097bdb Mon Sep 17 00:00:00 2001 From: Yevgen Muntyan <17531749+muntyan@users.noreply.github.com> Date: Thu, 20 Apr 2006 23:44:50 -0500 Subject: [PATCH] Use moo_edit_get_window() and moo_position_window() --- moo.kdevelop | 8 ++++---- moo/mooedit/mooedit-script.c | 10 +++------- moo/mooedit/mooedit.c | 8 +++----- moo/mooedit/mooplugin.c | 4 +--- moo/mooutils/mooaccelbutton.c | 7 +++++-- 5 files changed, 16 insertions(+), 21 deletions(-) diff --git a/moo.kdevelop b/moo.kdevelop index c4f53bce..e0492fca 100644 --- a/moo.kdevelop +++ b/moo.kdevelop @@ -288,16 +288,16 @@ - + A new empty GAP source file - + A new empty C++ file. - + A new empty header file for C/C++. - + A new empty C file. diff --git a/moo/mooedit/mooedit-script.c b/moo/mooedit/mooedit-script.c index aa6da3d0..2305bdd4 100644 --- a/moo/mooedit/mooedit-script.c +++ b/moo/mooedit/mooedit-script.c @@ -125,18 +125,13 @@ moo_edit_context_set_doc (MooEditContext *ctx, MooEdit *doc) { MSValue *val; - GtkWidget *window = NULL; + MooEditWindow *window = NULL; g_return_if_fail (MOO_IS_EDIT_CONTEXT (ctx)); g_return_if_fail (!doc || MOO_IS_EDIT (doc)); if (doc) - { - GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (doc)); - - if (GTK_IS_WINDOW (toplevel)) - window = toplevel; - } + window = moo_edit_get_window (doc); g_object_set (ctx, "window", window, NULL); @@ -212,6 +207,7 @@ moo_text_context_new (GtkTextView *doc) return moo_edit_context_new (MOO_EDIT (doc), NULL); window = gtk_widget_get_toplevel (GTK_WIDGET (doc)); + ctx = g_object_new (MS_TYPE_CONTEXT, "window", GTK_IS_WINDOW (window) ? window : NULL, NULL); diff --git a/moo/mooedit/mooedit.c b/moo/mooedit/mooedit.c index 69cead7a..a410c96d 100644 --- a/moo/mooedit/mooedit.c +++ b/moo/mooedit/mooedit.c @@ -1703,21 +1703,19 @@ void _moo_edit_do_popup (MooEdit *edit, GdkEventButton *event) { - GtkWidget *window; MooUIXML *xml; + MooEditWindow *window; xml = moo_editor_get_ui_xml (edit->priv->editor); g_return_if_fail (xml != NULL); - window = gtk_widget_get_toplevel (GTK_WIDGET (edit)); - if (!edit->priv->menu) { + window = moo_edit_get_window (edit); edit->priv->menu = moo_ui_xml_create_widget (xml, MOO_UI_MENU, "Editor/Popup", moo_edit_get_actions (edit), - MOO_IS_EDIT_WINDOW (window) ? - MOO_WINDOW(window)->accel_group : NULL); + window ? MOO_WINDOW(window)->accel_group : NULL); gtk_object_sink (g_object_ref (edit->priv->menu)); } diff --git a/moo/mooedit/mooplugin.c b/moo/mooedit/mooplugin.c index e9abfe6c..fd7156e8 100644 --- a/moo/mooedit/mooplugin.c +++ b/moo/mooedit/mooplugin.c @@ -1013,12 +1013,10 @@ doc_lang_changed (MooEdit *doc) g_return_if_fail (MOO_IS_EDIT (doc)); + window = moo_edit_get_window (doc); lang = moo_text_view_get_lang (MOO_TEXT_VIEW (doc)); id = LANG_ID (lang); - if ((toplevel = gtk_widget_get_toplevel (GTK_WIDGET (doc)))) - window = MOO_EDIT_WINDOW (toplevel); - for (l = plugin_store->list; l != NULL; l = l->next) { MooPlugin *plugin = l->data; diff --git a/moo/mooutils/mooaccelbutton.c b/moo/mooutils/mooaccelbutton.c index 7f51bc05..31227282 100644 --- a/moo/mooutils/mooaccelbutton.c +++ b/moo/mooutils/mooaccelbutton.c @@ -16,6 +16,7 @@ #include "mooutils/mooglade.h" #include "mooutils/moocompat.h" #include "mooutils/moomarshals.h" +#include "mooutils/moodialogs.h" #include #include #include @@ -273,8 +274,10 @@ static void moo_accel_button_clicked (MooAccelButton *button) if (button->title) gtk_window_set_title (GTK_WINDOW (dialog), button->title); - gtk_window_set_transient_for (GTK_WINDOW (dialog), - GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (button)))); + + moo_position_window (dialog, + gtk_widget_get_toplevel (GTK_WIDGET (button)), + FALSE, FALSE, 0, 0); ok_button = moo_glade_xml_get_widget (xml, "ok"); cancel_button = moo_glade_xml_get_widget (xml, "cancel");