Use moo_edit_get_window() and moo_position_window()

master
Yevgen Muntyan 2006-04-20 23:44:50 -05:00
parent eb2bd52f49
commit 16137d0d50
5 changed files with 16 additions and 21 deletions

View File

@ -288,16 +288,16 @@
</kdevdoctreeview>
<kdevfilecreate>
<filetypes>
<type icon="source" ext="g" name="GAP source" create="template" >
<type icon="source" ext="g" create="template" name="GAP source" >
<descr>A new empty GAP source file</descr>
</type>
<type icon="source_cpp" ext="cpp" name="C++ Source" create="template" >
<type icon="source_cpp" ext="cpp" create="template" name="C++ Source" >
<descr>A new empty C++ file.</descr>
</type>
<type icon="source_h" ext="h" name="C/C++ Header" create="template" >
<type icon="source_h" ext="h" create="template" name="C/C++ Header" >
<descr>A new empty header file for C/C++.</descr>
</type>
<type icon="source_c" ext="c" name="C Source" create="template" >
<type icon="source_c" ext="c" create="template" name="C Source" >
<descr>A new empty C file.</descr>
</type>
</filetypes>

View File

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

View File

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

View File

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

View File

@ -16,6 +16,7 @@
#include "mooutils/mooglade.h"
#include "mooutils/moocompat.h"
#include "mooutils/moomarshals.h"
#include "mooutils/moodialogs.h"
#include <gtk/gtkaccelgroup.h>
#include <gtk/gtkdialog.h>
#include <gtk/gtklabel.h>
@ -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");