Mercurial > pidgin
changeset 11558:19941a47405c
[gaim-migrate @ 13820]
Compiles against GTK < 2.4
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Tue, 20 Sep 2005 22:08:40 +0000 |
parents | 1e7c0773380f |
children | 5909ea4e7746 |
files | src/gtkmenutray.c src/gtkmenutray.h src/gtkwhiteboard.c |
diffstat | 3 files changed, 23 insertions(+), 42 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gtkmenutray.c Tue Sep 20 21:47:57 2005 +0000 +++ b/src/gtkmenutray.c Tue Sep 20 22:08:40 2005 +0000 @@ -19,16 +19,6 @@ */ #include "gtkmenutray.h" -#define GAIM_GTK_MENU_TRAY_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE((obj), GAIM_GTK_TYPE_MENU_TRAY, GaimGtkMenuTrayPriv)) - -/****************************************************************************** - * Structs - *****************************************************************************/ -typedef struct { - GtkWidget *tray; -} GaimGtkMenuTrayPriv; - /****************************************************************************** * Enums *****************************************************************************/ @@ -89,10 +79,9 @@ static void gaim_gtk_menu_tray_finalize(GObject *obj) { - GaimGtkMenuTrayPriv *priv = GAIM_GTK_MENU_TRAY_GET_PRIVATE(obj); - - if(GTK_IS_WIDGET(priv->tray)) - gtk_widget_destroy(GTK_WIDGET(priv->tray)); + GaimGtkMenuTray *tray = GAIM_GTK_MENU_TRAY(obj); + if(GTK_IS_WIDGET(tray->tray)) + gtk_widget_destroy(GTK_WIDGET(tray->tray)); G_OBJECT_CLASS(parent_class)->finalize(obj); } @@ -111,8 +100,6 @@ item_class->select = gaim_gtk_menu_tray_select; item_class->deselect = gaim_gtk_menu_tray_deselect; - g_type_class_add_private(klass, sizeof(GaimGtkMenuTrayPriv)); - pspec = g_param_spec_object("box", "The box", "The box", GTK_TYPE_BOX, @@ -122,16 +109,14 @@ static void gaim_gtk_menu_tray_init(GaimGtkMenuTray *menu_tray) { - GaimGtkMenuTrayPriv *priv = GAIM_GTK_MENU_TRAY_GET_PRIVATE(menu_tray); - gtk_menu_item_set_right_justified(GTK_MENU_ITEM(menu_tray), TRUE); - if(!GTK_IS_WIDGET(priv->tray)) - priv->tray = gtk_hbox_new(FALSE, 0); + if(!GTK_IS_WIDGET(menu_tray->tray)) + menu_tray->tray = gtk_hbox_new(FALSE, 0); - gtk_container_add(GTK_CONTAINER(menu_tray), priv->tray); + gtk_container_add(GTK_CONTAINER(menu_tray), menu_tray->tray); - gtk_widget_show(priv->tray); + gtk_widget_show(menu_tray->tray); } /****************************************************************************** @@ -170,35 +155,22 @@ GtkWidget * gaim_gtk_menu_tray_get_box(GaimGtkMenuTray *menu_tray) { - GaimGtkMenuTrayPriv *priv; - g_return_val_if_fail(GAIM_GTK_IS_MENU_TRAY(menu_tray), NULL); - - priv = GAIM_GTK_MENU_TRAY_GET_PRIVATE(menu_tray); - - return priv->tray; + return menu_tray->tray; } void gaim_gtk_menu_tray_append(GaimGtkMenuTray *menu_tray, GtkWidget *widget) { - GaimGtkMenuTrayPriv *priv; - g_return_if_fail(GAIM_GTK_IS_MENU_TRAY(menu_tray)); g_return_if_fail(GTK_IS_WIDGET(widget)); - priv = GAIM_GTK_MENU_TRAY_GET_PRIVATE(menu_tray); - - gtk_box_pack_end(GTK_BOX(priv->tray), widget, FALSE, FALSE, 0); + gtk_box_pack_end(GTK_BOX(menu_tray->tray), widget, FALSE, FALSE, 0); } void gaim_gtk_menu_tray_prepend(GaimGtkMenuTray *menu_tray, GtkWidget *widget) { - GaimGtkMenuTrayPriv *priv; - g_return_if_fail(GAIM_GTK_IS_MENU_TRAY(menu_tray)); g_return_if_fail(GTK_IS_WIDGET(widget)); - priv = GAIM_GTK_MENU_TRAY_GET_PRIVATE(menu_tray); - - gtk_box_pack_start(GTK_BOX(priv->tray), widget, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(menu_tray->tray), widget, FALSE, FALSE, 0); }
--- a/src/gtkmenutray.h Tue Sep 20 21:47:57 2005 +0000 +++ b/src/gtkmenutray.h Tue Sep 20 22:08:40 2005 +0000 @@ -39,6 +39,7 @@ /** A GaimGtkMenuTray */ struct _GaimGtkMenuTray { GtkMenuItem gparent; /**< The parent instance */ + GtkWidget *tray; /**< The tray */ }; /** A GaimGtkMenuTrayClass */
--- a/src/gtkwhiteboard.c Tue Sep 20 21:47:57 2005 +0000 +++ b/src/gtkwhiteboard.c Tue Sep 20 22:08:40 2005 +0000 @@ -746,7 +746,8 @@ GtkWidget *dialog; int result; - + +#if GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */ dialog = gtk_file_chooser_dialog_new ("Save File", GTK_WINDOW(gtkwb->window), GTK_FILE_CHOOSER_ACTION_SAVE, @@ -763,15 +764,21 @@ } // else // gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog), filename_for_existing_document); - +#else + dialog = gtk_file_selection_new("Save File"); + gtk_file_selection_set_filename(GTK_FILE_SELECTION(dialog), "whiteboard.jpg"); +#endif result = gtk_dialog_run( GTK_DIALOG( dialog ) ); if( result == GTK_RESPONSE_ACCEPT ) { char *filename; - + +#if GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */ filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER( dialog ) ); - +#else + filename = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(dialog))); +#endif gtk_widget_destroy( dialog ); // Makes an icon from the whiteboard's canvas 'image' @@ -792,6 +799,7 @@ g_print( "File Saved...\n" ); else g_print( "File not Saved... Error\n" ); + g_free(filename); } else if( result == GTK_RESPONSE_CANCEL )