[dia/dia-next: 18/59] Comment out a lot of the sheets system, must reimplement later



commit 7479a0312f752bdbbc8258a00b9a157eafef0139
Author: Zander Brown <zbrown gnome org>
Date:   Sun Dec 23 19:38:46 2018 +0000

    Comment out a lot of the sheets system, must reimplement later

 app/sheets.c        | 63 +++++++++++++++--------------------------------------
 app/sheets.h        |  2 +-
 app/sheets_dialog.c | 37 +++++++------------------------
 3 files changed, 26 insertions(+), 76 deletions(-)
---
diff --git a/app/sheets.c b/app/sheets.c
index a7166c57..cf03121f 100644
--- a/app/sheets.c
+++ b/app/sheets.c
@@ -126,15 +126,12 @@ void
 sheets_optionmenu_create(GtkWidget *option_menu, GtkWidget *wrapbox,
                          gchar *sheet_name)
 {
-  GtkWidget *optionmenu_menu;
   GSList *sheets_list;
   GList *menu_item_list;
 
   /* Delete the contents, if any, of this optionemnu first */
 
-  optionmenu_menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(option_menu));
-  gtk_container_foreach(GTK_CONTAINER(optionmenu_menu),
-                        (GtkCallback)gtk_widget_destroy, NULL);
+  gtk_combo_box_text_remove_all (GTK_COMBO_BOX_TEXT (option_menu));
 
   for (sheets_list = sheets_mods_list; sheets_list;
        sheets_list = g_slist_next(sheets_list))
@@ -151,29 +148,16 @@ sheets_optionmenu_create(GtkWidget *option_menu, GtkWidget *wrapbox,
       continue;
 
     {
-      menu_item = gtk_menu_item_new_with_label(gettext(sheet_mod->sheet.name));
-
-      gtk_menu_append(GTK_MENU(optionmenu_menu), menu_item);
-      
-      if (sheet_mod->sheet.scope == SHEET_SCOPE_SYSTEM)
-       tip = g_strdup_printf(_("%s\nSystem sheet"), sheet_mod->sheet.description);
-      else
-       tip = g_strdup_printf(_("%s\nUser sheet"), sheet_mod->sheet.description);
-      
-      gtk_widget_set_tooltip_text(menu_item, tip);
-      g_free(tip);
+      // TODO: Don't gettext here
+      gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (option_menu), gettext(sheet_mod->sheet.name));
     }
-
-    gtk_widget_show(menu_item);
-
-    g_object_set_data(G_OBJECT(menu_item), "wrapbox", wrapbox);
-
-    g_signal_connect(G_OBJECT(menu_item), "activate",
-                    G_CALLBACK(on_sheets_dialog_optionmenu_activate),
-                       (gpointer)sheet_mod);
   }
+
+  g_signal_connect (G_OBJECT (option_menu), "changed",
+                    G_CALLBACK (on_sheets_dialog_optionmenu_activate),
+                    NULL);
  
-  menu_item_list = gtk_container_get_children(GTK_CONTAINER(optionmenu_menu));
+  menu_item_list = NULL/*gtk_container_get_children(GTK_CONTAINER(optionmenu_menu))*/;
 
   /* If we were passed a sheet_name, then make the optionmenu point to that
      name after creation */
@@ -187,14 +171,14 @@ sheets_optionmenu_create(GtkWidget *option_menu, GtkWidget *wrapbox,
                               menu_item_compare_labels);
     if (list)
       index = g_list_position(menu_item_list, list);
-    gtk_option_menu_set_history(GTK_OPTION_MENU(option_menu), index);
+    /*gtk_option_menu_set_history(GTK_OPTION_MENU(option_menu), index);
     gtk_menu_item_activate(GTK_MENU_ITEM(g_list_nth_data(menu_item_list,
-                                                         index)));
+                                                         index)));*/
   }
   else
   {
-    gtk_option_menu_set_history(GTK_OPTION_MENU(option_menu), 0);
-    gtk_menu_item_activate(GTK_MENU_ITEM(menu_item_list->data));
+    /*gtk_option_menu_set_history(GTK_OPTION_MENU(option_menu), 0);
+    gtk_menu_item_activate(GTK_MENU_ITEM(menu_item_list->data));*/
   }
 
   g_list_free(menu_item_list);
@@ -322,24 +306,18 @@ sheets_dialog_create(void)
 
 void
 create_object_pixmap(SheetObject *so, GtkWidget *parent,
-                     GdkPixmap **pixmap, GdkBitmap **mask)
+                     GdkPixbuf **pixmap)
 {
   GtkStyle *style;
 
   g_assert(so);
   g_assert(pixmap);
-  g_assert(mask);
   
   style = gtk_widget_get_style(parent);
   
   if (so->pixmap != NULL)
   {
-    *pixmap =
-      gdk_pixmap_colormap_create_from_xpm_d(NULL,
-                                            gtk_widget_get_colormap(parent),
-                                            mask, 
-                                            &style->bg[GTK_STATE_NORMAL],
-                                            (gchar **)so->pixmap);
+    *pixmap = gdk_pixbuf_new_from_xpm_data((const gchar **)so->pixmap);
   }
   else
   {
@@ -363,23 +341,16 @@ create_object_pixmap(SheetObject *so, GtkWidget *parent,
          g_object_unref (pixbuf);
          pixbuf = cropped;
        }
-        gdk_pixbuf_render_pixmap_and_mask(pixbuf, pixmap, mask, 1.0);
-        g_object_unref(pixbuf);
+        *pixmap = pixbuf;
       } else {
         message_warning ("%s", error->message);
         g_error_free (error);
-       *pixmap = gdk_pixmap_colormap_create_from_xpm_d
-         (NULL,
-          gtk_widget_get_colormap(parent),
-          mask, 
-          &style->bg[GTK_STATE_NORMAL],
-          (gchar **)missing);
+       *pixmap = gdk_pixbuf_new_from_xpm_data((const gchar **)missing);
       }
     }
     else
     {
       *pixmap = NULL;
-      *mask = NULL;
     }
   }
 }
@@ -398,7 +369,7 @@ lookup_widget (GtkWidget   *widget,
       if (GTK_IS_MENU (widget))
         parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
       else
-        parent = widget->parent;
+        parent = gtk_widget_get_parent (widget);
       if (parent == NULL)
         break;
       widget = parent;
diff --git a/app/sheets.h b/app/sheets.h
index 6d6d4817..14c8908c 100644
--- a/app/sheets.h
+++ b/app/sheets.h
@@ -74,7 +74,7 @@ SheetMod *sheets_append_sheet_mods(Sheet *sheet);
 void sheets_optionmenu_create(GtkWidget *option_menu, GtkWidget *wrapbox,
                               gchar *sheet_name);
 void create_object_pixmap(SheetObject *so, GtkWidget *parent,
-                          GdkPixmap **pixmap, GdkBitmap **mask);
+                          GdkPixbuf **pixmap);
 
 gchar *sheet_object_mod_get_type_string(SheetObjectMod *som);
 
diff --git a/app/sheets_dialog.c b/app/sheets_dialog.c
index f2405bd1..e67378a5 100644
--- a/app/sheets_dialog.c
+++ b/app/sheets_dialog.c
@@ -82,8 +82,6 @@ create_sheets_main_dialog (void)
 {
   GtkWidget *sheets_main_dialog;
   GtkWidget *optionmenu_left, *optionmenu_right;
-  GtkWidget *optionmenu_left_menu, *optionmenu_right_menu;
-  GtkWidget *glade_menuitem;
   GtkBuilder *builder;
 
   builder = builder_new_from_file ("ui/sheets-main-dialog.xml");
@@ -94,15 +92,8 @@ create_sheets_main_dialog (void)
                    G_CALLBACK (sheets_dialog_destroyed), NULL);
 
   optionmenu_right = GTK_WIDGET (gtk_builder_get_object (builder, "optionmenu_right"));
-  optionmenu_right_menu = gtk_menu_new ();
-  gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu_right), optionmenu_right_menu);
 
   optionmenu_left = GTK_WIDGET (gtk_builder_get_object (builder, "optionmenu_left"));
-  optionmenu_left_menu = gtk_menu_new ();
-  glade_menuitem = gtk_menu_item_new_with_label ("");
-  gtk_widget_show (glade_menuitem);
-  gtk_menu_append (GTK_MENU (optionmenu_left_menu), glade_menuitem);
-  gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu_left), optionmenu_left_menu);
 
   g_signal_connect (gtk_builder_get_object (builder,"sheets_main_dialog"), "delete_event",
                       G_CALLBACK (on_sheets_main_dialog_delete_event),
@@ -250,27 +241,15 @@ create_sheets_shapeselection_dialog (void)
   GtkWidget *ok_button;
   GtkWidget *cancel_button1;
 
-  sheets_shapeselection_dialog = gtk_file_selection_new (_("Select SVG Shape File"));
-  g_object_set_data (G_OBJECT (sheets_shapeselection_dialog), "sheets_shapeselection_dialog", 
sheets_shapeselection_dialog);
-  gtk_container_set_border_width (GTK_CONTAINER (sheets_shapeselection_dialog), 10);
-
-  ok_button = GTK_FILE_SELECTION (sheets_shapeselection_dialog)->ok_button;
-  g_object_set_data (G_OBJECT (sheets_shapeselection_dialog), "ok_button", ok_button);
-  gtk_widget_show (ok_button);
-#if GTK_CHECK_VERSION(2,18,0)
-  gtk_widget_set_can_default (GTK_WIDGET (ok_button), TRUE);
-#else
-  GTK_WIDGET_SET_FLAGS (ok_button, GTK_CAN_DEFAULT);
-#endif
+  sheets_shapeselection_dialog = gtk_file_chooser_dialog_new (_("Select SVG Shape File"),
+                                                              NULL,
+                                                              GTK_FILE_CHOOSER_ACTION_OPEN,
+                                                              NULL);
 
-  cancel_button1 = GTK_FILE_SELECTION (sheets_shapeselection_dialog)->cancel_button;
-  g_object_set_data (G_OBJECT (sheets_shapeselection_dialog), "cancel_button1", cancel_button1);
-  gtk_widget_show (cancel_button1);
-#if GTK_CHECK_VERSION(2,18,0)
-  gtk_widget_set_can_default (GTK_WIDGET (cancel_button1), TRUE);
-#else
-  GTK_WIDGET_SET_FLAGS (cancel_button1, GTK_CAN_DEFAULT);
-#endif
+  ok_button = gtk_dialog_add_button (GTK_DIALOG (sheets_shapeselection_dialog), _("Open"), GTK_RESPONSE_OK);
+  cancel_button1 = gtk_dialog_add_button (GTK_DIALOG (sheets_shapeselection_dialog), _("Open"), 
GTK_RESPONSE_CANCEL);
+
+  g_object_set_data (G_OBJECT (sheets_shapeselection_dialog), "sheets_shapeselection_dialog", 
sheets_shapeselection_dialog);
 
   g_signal_connect (G_OBJECT (ok_button), "clicked",
                     G_CALLBACK (on_sheets_shapeselection_dialog_button_ok_clicked),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]