Added -DGTK_DISABLE_DEPRECATED to debug flags; fixed couple of MooPaned bugs

This commit is contained in:
Yevgen Muntyan 2005-08-05 14:14:04 +00:00
parent acb658ad42
commit b3b1f5dfdb
8 changed files with 81 additions and 23 deletions

View File

@ -442,8 +442,9 @@ DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -W -Wall -Woverloaded-virtual dnl
fi
if test x$debug = "xyes"; then
flags="-DG_DISABLE_DEPRECATED -DDEBUG dnl
-DENABLE_DEBUG -DENABLE_PROFILE -DG_ENABLE_DEBUG -DG_ENABLE_PROFILE"
flags="-DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED dnl
-DGDK_DISABLE_DEPRECATED -DDEBUG -DENABLE_DEBUG -DENABLE_PROFILE dnl
-DG_ENABLE_DEBUG -DG_ENABLE_PROFILE"
else
flags="-DNDEBUG=1 -DG_DISABLE_CAST_CHECKS -DG_DISABLE_ASSERT"
fi

View File

@ -36,7 +36,7 @@
<useconfiguration>debug</useconfiguration>
</general>
<run>
<mainprogram>tests/testpanedfileview</mainprogram>
<mainprogram>tests/editor</mainprogram>
<directoryradio>executable</directoryradio>
<customdirectory>/</customdirectory>
<programargs></programargs>
@ -46,7 +46,7 @@
</run>
<configurations>
<debug>
<configargs>--enable-debug=full --enable-all-gcc-warnings=fatal --enable-developer-mode --disable-moo-module --without-mooui --without-mooapp --without-mooterm --without-python</configargs>
<configargs>--enable-debug=full --enable-all-gcc-warnings=fatal --enable-developer-mode --disable-moo-module --without-python</configargs>
<builddir>build/debug</builddir>
<ccompiler>kdevgccoptions</ccompiler>
<cxxcompiler>kdevgppoptions</cxxcompiler>
@ -158,7 +158,7 @@
<abortonerror>true</abortonerror>
<numberofjobs>1</numberofjobs>
<dontact>false</dontact>
<makebin></makebin>
<makebin/>
<prio>0</prio>
</make>
</kdevautoproject>
@ -234,16 +234,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

@ -424,13 +424,13 @@ static Filter *filter_new (const char *description,
filter->user = user;
filter->filter = gtk_file_filter_new ();
gtk_object_sink (gtk_object_ref (GTK_OBJECT (filter->filter)));
gtk_object_sink (GTK_OBJECT (g_object_ref (filter->filter)));
gtk_file_filter_set_name (filter->filter, description);
if (negative)
{
filter->aux = gtk_file_filter_new ();
gtk_object_sink (gtk_object_ref (GTK_OBJECT (filter->aux)));
gtk_object_sink (GTK_OBJECT (g_object_ref (filter->aux)));
for (p = globs; *p != NULL; p++)
gtk_file_filter_add_pattern (filter->aux, *p);
@ -874,7 +874,7 @@ static void mgr_recent_stuff_init (MooEditFileMgr *mgr)
{
mgr->priv->recent = g_new0 (RecentStuff, 1);
mgr->priv->recent->tooltips = gtk_tooltips_new ();
gtk_object_sink (gtk_object_ref (GTK_OBJECT (mgr->priv->recent->tooltips)));
gtk_object_sink (GTK_OBJECT (g_object_ref (mgr->priv->recent->tooltips)));
mgr->priv->recent->display_full_name = FALSE;
}

View File

@ -14,16 +14,19 @@
#define MOOEDIT_COMPILATION
#include "mooedit/mooedit-private.h"
#include "mooedit/mooeditdialogs.h"
#include "mooedit/moofileview.h"
#include "mooui/moouiobject-impl.h"
#include "mooui/moomenuaction.h"
#include "mooutils/moocompat.h"
#include "mooutils/moostock.h"
#include "mooutils/moomarshals.h"
#include "mooutils/moosignal.h"
#include "mooutils/moopaned.h"
#include <string.h>
struct _MooEditWindowPrivate {
MooPaned *paned;
GtkNotebook *notebook;
gboolean use_fullname;
char *app_name;
@ -85,6 +88,10 @@ static void cursor_moved (MooEditWindow *window,
static void file_saved (MooEditWindow *window,
MooEditFileInfo *info);
static void fileview_activate (MooEditWindow *window,
MooFileViewFile *file);
/* actions */
static void moo_edit_window_new_cb (MooEditWindow *window);
@ -416,8 +423,9 @@ GObject *moo_edit_window_constructor (GType type,
guint n_props,
GObjectConstructParam *props)
{
GtkWidget *notebook;
GtkWidget *notebook, *paned, *fileview;
MooEdit *edit;
MooEditFileMgr *mgr = NULL;
MooEditWindow *window;
GObject *object =
@ -432,10 +440,29 @@ GObject *moo_edit_window_constructor (GType type,
"MooEditWindow");
gtk_widget_show (MOO_WINDOW(window)->vbox);
paned = moo_paned_new (GTK_POS_RIGHT);
gtk_widget_show (paned);
gtk_box_pack_start (GTK_BOX (MOO_WINDOW(window)->vbox), paned, TRUE, TRUE, 0);
window->priv->paned = MOO_PANED (paned);
if (window->priv->editor)
mgr = moo_editor_get_file_mgr (window->priv->editor);
fileview = GTK_WIDGET (g_object_new (MOO_TYPE_FILE_VIEW,
"file-mgr", mgr, NULL));
g_signal_connect_swapped (fileview, "activate",
G_CALLBACK (fileview_activate),
window);
moo_paned_add_pane (MOO_PANED (paned),
fileview, "File Selector",
GTK_STOCK_OPEN);
notebook = gtk_notebook_new ();
gtk_notebook_set_scrollable (GTK_NOTEBOOK (notebook), TRUE);
gtk_widget_show (notebook);
gtk_box_pack_start (GTK_BOX (MOO_WINDOW(window)->vbox), notebook, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (paned), notebook);
window->priv->notebook = GTK_NOTEBOOK (notebook);
g_signal_connect_after (window->priv->notebook, "switch-page",
@ -826,7 +853,7 @@ gboolean _moo_edit_window_open (MooEditWindow *window,
if (!moo_edit_is_empty (edit))
{
edit = _moo_edit_new (window->priv->editor);
gtk_object_sink (gtk_object_ref (GTK_OBJECT (edit)));
gtk_object_sink (GTK_OBJECT (g_object_ref (edit)));
add = TRUE;
}
@ -1131,3 +1158,15 @@ static void file_saved (MooEditWindow *window,
{
g_signal_emit (window, signals[FILE_SAVED], 0, info);
}
static void fileview_activate (MooEditWindow *window,
MooFileViewFile *file)
{
const char *path = moo_file_view_file_path (file);
if (_moo_edit_window_open (window, path, NULL))
{
MooEdit *edit = moo_edit_window_get_active_doc (window);
gtk_widget_grab_focus (GTK_WIDGET (edit));
}
}

View File

@ -15,6 +15,12 @@
#include "config.h"
#endif
#ifdef GTK_DISABLE_DEPRECATED
# undef GTK_DISABLE_DEPRECATED
# include <gtk/gtktoolbar.h>
# define GTK_DISABLE_DEPRECATED
#endif
#include "mooedit/moofileview.h"
#include "mooedit/mooeditfilemgr.h"
#include "mooutils/moomarshals.h"
@ -430,6 +436,7 @@ static void init_gui (MooFileView *fileview)
toolbar = create_toolbar (fileview);
gtk_widget_show (toolbar);
gtk_box_pack_start (box, toolbar, FALSE, FALSE, 0);
fileview->toolbar = toolbar;
notebook = create_notebook (fileview);
gtk_widget_show (notebook);
@ -472,8 +479,10 @@ static GtkWidget *create_toolbar (MooFileView *fileview)
toolbar = gtk_toolbar_new ();
gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar), TRUE);
gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar),
GTK_ICON_SIZE_MENU);
gtk_toolbar_set_style (GTK_TOOLBAR (toolbar),
GTK_TOOLBAR_ICONS);
@ -1525,7 +1534,7 @@ static void fileview_set_filter (MooFileView *fileview,
if (filter)
{
const char *name;
gtk_object_sink (gtk_object_ref (GTK_OBJECT (filter)));
gtk_object_sink (GTK_OBJECT (g_object_ref (filter)));
name = gtk_file_filter_get_name (filter);
gtk_entry_set_text (fileview->priv->filter_entry, name);
fileview_set_use_filter (fileview, TRUE, FALSE);

View File

@ -42,6 +42,7 @@ typedef struct _MooFileViewClass MooFileViewClass;
struct _MooFileView
{
GtkVBox vbox;
GtkWidget *toolbar;
MooFileViewPrivate *priv;
};

View File

@ -250,7 +250,7 @@ static void moo_term_class_init (MooTermClass *klass)
NULL, NULL,
_moo_marshal_VOID__UINT,
G_TYPE_NONE, 1,
GTK_TYPE_UINT);
G_TYPE_UINT);
signals[APPLY_SETTINGS] =
g_signal_new ("apply-settings",
@ -1718,10 +1718,10 @@ static gboolean moo_term_scroll (GtkWidget *widget,
static const GtkTargetEntry target_table[] = {
{ "UTF8_STRING", 0, 0 },
{ "TEXT", 0, 0 },
{ "text/plain", 0, 0 },
{ "text/plain;charset=utf-8", 0, 0 }
{ (char*) "UTF8_STRING", 0, 0 },
{ (char*) "TEXT", 0, 0 },
{ (char*) "text/plain", 0, 0 },
{ (char*) "text/plain;charset=utf-8", 0, 0 }
};

View File

@ -258,7 +258,7 @@ static GObject *moo_paned_constructor (GType type,
break;
}
gtk_object_sink (gtk_object_ref (GTK_OBJECT (paned->button_box)));
gtk_object_sink (GTK_OBJECT (g_object_ref (paned->button_box)));
gtk_widget_set_parent (paned->button_box, GTK_WIDGET (paned));
gtk_widget_show (paned->button_box);
g_signal_connect_swapped (paned->button_box, "notify::visible",
@ -1050,6 +1050,8 @@ static void moo_paned_size_allocate (GtkWidget *widget,
if (paned->priv->pane_window)
{
get_pane_window_rect (paned, &rect);
gdk_window_show (paned->priv->pane_window);
gdk_window_raise (paned->priv->pane_window);
gdk_window_move_resize (paned->priv->pane_window,
rect.x, rect.y,
rect.width, rect.height);
@ -1203,6 +1205,10 @@ static void button_toggled (GtkToggleButton *button,
paned->priv->current_pane->button == GTK_WIDGET (button))
{
gtk_widget_hide (paned->priv->current_pane->frame);
if (GTK_WIDGET_REALIZED (paned))
gdk_window_hide (paned->priv->pane_window);
paned->priv->current_pane = NULL;
paned->priv->pane_widget_visible = FALSE;
paned->priv->pane_widget_size = 0;
@ -1227,6 +1233,8 @@ static void button_toggled (GtkToggleButton *button,
{
gtk_widget_set_parent_window (pane->frame,
paned->priv->pane_window);
gdk_window_show (paned->priv->pane_window);
gdk_window_raise (paned->priv->pane_window);
gtk_widget_queue_resize (GTK_WIDGET (paned));
}
@ -1679,7 +1687,7 @@ void moo_paned_insert_pane (MooPaned *paned,
pane = g_new (Pane, 1);
pane->frame = create_frame_widget (paned, pane);
gtk_object_sink (gtk_object_ref (GTK_OBJECT (pane->frame)));
gtk_object_sink (GTK_OBJECT (g_object_ref (pane->frame)));
gtk_widget_set_parent (pane->frame, GTK_WIDGET (paned));
pane->child = pane_widget;