[dia/dia-next: 36/59] DiaLineStyleSelector -> DiaLineChooser



commit 28489446c222c088514797cbf60c02263f67051b
Author: Zander Brown <zbrown gnome org>
Date:   Sat Dec 29 03:23:14 2018 +0000

    DiaLineStyleSelector -> DiaLineChooser
    
    Rename for consistancy with ArrowChooser & SheetChooser

 app/toolbox.c                                      |  6 +--
 ...ctor-popover.ui => dia-line-chooser-popover.ui} |  2 +-
 lib/Makefile.am                                    |  4 +-
 lib/dia-line-style-selector-popover.h              | 28 -----------
 lib/dia-line-style-selector.h                      | 48 ------------------
 lib/libdia.def                                     |  8 +--
 lib/prop_attr.c                                    | 14 +++---
 lib/widgets.h                                      |  2 +-
 .../dia-line-chooser-popover.c}                    | 58 +++++++++++-----------
 lib/widgets/dia-line-chooser-popover.h             | 28 +++++++++++
 .../dia-line-chooser.c}                            | 56 ++++++++++-----------
 lib/widgets/dia-line-chooser.h                     | 48 ++++++++++++++++++
 12 files changed, 151 insertions(+), 151 deletions(-)
---
diff --git a/app/toolbox.c b/app/toolbox.c
index 0c9eba52..d589a104 100644
--- a/app/toolbox.c
+++ b/app/toolbox.c
@@ -460,7 +460,7 @@ change_line_style(DiaLineStyleSelector *selector, gpointer user_data)
 {
   LineStyle lstyle;
   real dash_length;
-  dia_line_style_selector_get_line_style (selector, &lstyle, &dash_length);
+  dia_line_chooser_get_line_style (selector, &lstyle, &dash_length);
   attributes_set_default_line_style (lstyle, dash_length);
 }
 
@@ -495,14 +495,14 @@ create_lineprops_area (DiaToolbox *self)
   gtk_widget_set_tooltip_text (chooser, _("Arrow style at the beginning of new lines.  Click to pick an 
arrow, or set arrow parameters with Details\342\200\246"));
   gtk_widget_show (chooser);
 
-  chooser = dia_line_style_selector_new ();
+  chooser = dia_line_chooser_new ();
   g_signal_connect (G_OBJECT (chooser), "value-changed",
                     G_CALLBACK (change_line_style), NULL);
   gtk_container_add (GTK_CONTAINER (box), chooser);
   gtk_widget_set_tooltip_text (chooser, _("Line style for new lines.  Click to pick a line style, or set 
line style parameters with Details\342\200\246"));
   style = persistence_register_integer ("line-style", LINESTYLE_SOLID);
   dash_length = persistence_register_real ("dash-length", DEFAULT_LINESTYLE_DASHLEN);
-  dia_line_style_selector_set_line_style (DIA_LINE_STYLE_SELECTOR (chooser), style, dash_length);
+  dia_line_chooser_set_line_style (DIA_LINE_CHOOSER (chooser), style, dash_length);
   gtk_widget_show (chooser);
 
   chooser = dia_arrow_chooser_new (FALSE);
diff --git a/data/dia-line-style-selector-popover.ui b/data/dia-line-chooser-popover.ui
similarity index 98%
rename from data/dia-line-style-selector-popover.ui
rename to data/dia-line-chooser-popover.ui
index 4e2e0780..91cff6af 100644
--- a/data/dia-line-style-selector-popover.ui
+++ b/data/dia-line-chooser-popover.ui
@@ -8,7 +8,7 @@
     <property name="step_increment">0.10000000000000001</property>
     <property name="page_increment">1</property>
   </object>
-  <template class="DiaLineStyleSelectorPopover" parent="GtkPopover">
+  <template class="DiaLineChooserPopover" parent="GtkPopover">
     <property name="can_focus">False</property>
     <child>
       <object class="GtkBox">
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 7b65fd30..d75505bf 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -192,8 +192,8 @@ libdia_la_SOURCES =  \
                widgets/dia-arrow-chooser.h \
                widgets/dia-arrow-chooser.c \
                diacolorselector.c \
-               dia-line-style-selector-popover.c \
-               dia-line-style-selector.c \
+               widgets/dia-line-chooser-popover.c \
+               widgets/dia-line-chooser.c \
                diadynamicmenu.h \
                diadynamicmenu.c \
                diafontselector.h \
diff --git a/lib/libdia.def b/lib/libdia.def
index ebd01da9..1862c9ce 100644
--- a/lib/libdia.def
+++ b/lib/libdia.def
@@ -307,10 +307,10 @@ EXPORTS
  
  dia_line_chooser_new
 
- dia_line_style_selector_get_linestyle
- dia_line_style_selector_get_type
- dia_line_style_selector_new
- dia_line_style_selector_set_linestyle
+ dia_line_chooser_get_linestyle
+ dia_line_chooser_get_type
+ dia_line_chooser_new
+ dia_line_chooser_set_linestyle
 
  dia_line_chooser_get_type
  dia_line_chooser_set_line_style
diff --git a/lib/prop_attr.c b/lib/prop_attr.c
index bc69e5a6..e29ecb3d 100644
--- a/lib/prop_attr.c
+++ b/lib/prop_attr.c
@@ -64,7 +64,7 @@ linestyleprop_copy(LinestyleProperty *src)
 static WIDGET *
 linestyleprop_get_widget(LinestyleProperty *prop, PropDialog *dialog)
 {
-  GtkWidget *ret = dia_line_style_selector_new();
+  GtkWidget *ret = dia_line_chooser_new();
   prophandler_connect(&prop->common, G_OBJECT(ret), "value-changed");
   return ret;
 }
@@ -72,17 +72,17 @@ linestyleprop_get_widget(LinestyleProperty *prop, PropDialog *dialog)
 static void 
 linestyleprop_reset_widget(LinestyleProperty *prop, WIDGET *widget)
 {
-  dia_line_style_selector_set_line_style (DIA_LINE_STYLE_SELECTOR(widget),
-                                          prop->style,
-                                          prop->dash);
+  dia_line_chooser_set_line_style (DIA_LINE_CHOOSER (widget),
+                                   prop->style,
+                                   prop->dash);
 }
 
 static void 
 linestyleprop_set_from_widget(LinestyleProperty *prop, WIDGET *widget) 
 {
-  dia_line_style_selector_get_line_style(DIA_LINE_STYLE_SELECTOR(widget),
-                                        &prop->style,
-                                        &prop->dash);
+  dia_line_chooser_get_line_style (DIA_LINE_CHOOSER (widget),
+                                   &prop->style,
+                                   &prop->dash);
 }
 
 static void 
diff --git a/lib/widgets.h b/lib/widgets.h
index aeaba571..72a9b35f 100644
--- a/lib/widgets.h
+++ b/lib/widgets.h
@@ -25,7 +25,7 @@
 #include "font.h"
 #include "arrows.h"
 #include "units.h"
-#include "dia-line-style-selector.h"
+#include "widgets/dia-line-chooser.h"
 
 /* DiaAlignmentSelector: */
 GtkWidget* dia_alignment_selector_new           (void);
diff --git a/lib/dia-line-style-selector-popover.c b/lib/widgets/dia-line-chooser-popover.c
similarity index 58%
rename from lib/dia-line-style-selector-popover.c
rename to lib/widgets/dia-line-chooser-popover.c
index 3e0d153c..c466b875 100644
--- a/lib/dia-line-style-selector-popover.c
+++ b/lib/widgets/dia-line-chooser-popover.c
@@ -1,20 +1,20 @@
 #include <glib.h>
 #include <gtk/gtk.h>
 
-#include "dia-line-style-selector.h"
-#include "dia-line-style-selector-popover.h"
+#include "dia-line-chooser.h"
+#include "dia-line-chooser-popover.h"
 #include "dia_dirs.h"
 
-typedef struct _DiaLineStyleSelectorPopoverPrivate DiaLineStyleSelectorPopoverPrivate;
+typedef struct _DiaLineChooserPopoverPrivate DiaLineChooserPopoverPrivate;
 
-struct _DiaLineStyleSelectorPopoverPrivate {
+struct _DiaLineChooserPopoverPrivate {
  GtkWidget *list;
  GtkWidget *length;
  GtkWidget *length_box;
 };
 
-G_DEFINE_TYPE_WITH_CODE (DiaLineStyleSelectorPopover, dia_line_style_selector_popover, GTK_TYPE_POPOVER,
-                         G_ADD_PRIVATE (DiaLineStyleSelectorPopover))
+G_DEFINE_TYPE_WITH_CODE (DiaLineChooserPopover, dia_line_chooser_popover, GTK_TYPE_POPOVER,
+                         G_ADD_PRIVATE (DiaLineChooserPopover))
 
 enum {
   VALUE_CHANGED,
@@ -24,16 +24,16 @@ enum {
 static guint signals[LAST_SIGNAL] = { 0 };
 
 GtkWidget *
-dia_line_style_selector_popover_new ()
+dia_line_chooser_popover_new ()
 {
-  return g_object_new (DIA_TYPE_LINE_STYLE_SELECTOR_POPOVER, NULL);
+  return g_object_new (DIA_TYPE_LINE_CHOOSER_POPOVER, NULL);
 }
 
 LineStyle
-dia_line_style_selector_popover_get_line_style (DiaLineStyleSelectorPopover *self,
-                                                gdouble                     *length)
+dia_line_chooser_popover_get_line_style (DiaLineChooserPopover *self,
+                                         gdouble               *length)
 {
-  DiaLineStyleSelectorPopoverPrivate *priv = dia_line_style_selector_popover_get_instance_private (self);
+  DiaLineChooserPopoverPrivate *priv = dia_line_chooser_popover_get_instance_private (self);
   GtkListBoxRow *row;
   GtkWidget *preview;
   LineStyle style;
@@ -51,10 +51,10 @@ dia_line_style_selector_popover_get_line_style (DiaLineStyleSelectorPopover *sel
 }
 
 void
-dia_line_style_selector_popover_set_line_style (DiaLineStyleSelectorPopover *self,
-                                                LineStyle                    line_style)
+dia_line_chooser_popover_set_line_style (DiaLineChooserPopover *self,
+                                         LineStyle              line_style)
 {
-  DiaLineStyleSelectorPopoverPrivate *priv = dia_line_style_selector_popover_get_instance_private (self);
+  DiaLineChooserPopoverPrivate *priv = dia_line_chooser_popover_get_instance_private (self);
   GtkListBoxRow *row;
 
   row = gtk_list_box_get_row_at_index (GTK_LIST_BOX (priv->list), line_style);
@@ -62,16 +62,16 @@ dia_line_style_selector_popover_set_line_style (DiaLineStyleSelectorPopover *sel
 }
 
 void
-dia_line_style_selector_popover_set_length (DiaLineStyleSelectorPopover *self,
-                                            gdouble                      length)
+dia_line_chooser_popover_set_length (DiaLineChooserPopover *self,
+                                     gdouble                length)
 {
-  DiaLineStyleSelectorPopoverPrivate *priv = dia_line_style_selector_popover_get_instance_private (self);
+  DiaLineChooserPopoverPrivate *priv = dia_line_chooser_popover_get_instance_private (self);
 
   gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->length), length);
 }
 
 static void
-dia_line_style_selector_popover_class_init (DiaLineStyleSelectorPopoverClass *klass)
+dia_line_chooser_popover_class_init (DiaLineChooserPopoverClass *klass)
 {
   GFile *template_file;
   GBytes *template;
@@ -86,16 +86,16 @@ dia_line_style_selector_popover_class_init (DiaLineStyleSelectorPopoverClass *kl
                                          G_TYPE_NONE, 0);
 
   /* TODO: Use GResource */
-  template_file = g_file_new_for_path (build_ui_filename ("ui/dia-line-style-selector-popover.ui"));
+  template_file = g_file_new_for_path (build_ui_filename ("ui/dia-line-chooser-popover.ui"));
   template = g_file_load_bytes (template_file, NULL, NULL, &err);
 
   if (err)
     g_critical ("Failed to load template: %s", err->message);
 
   gtk_widget_class_set_template (widget_class, template);
-  gtk_widget_class_bind_template_child_private (widget_class, DiaLineStyleSelectorPopover, list);
-  gtk_widget_class_bind_template_child_private (widget_class, DiaLineStyleSelectorPopover, length);
-  gtk_widget_class_bind_template_child_private (widget_class, DiaLineStyleSelectorPopover, length_box);
+  gtk_widget_class_bind_template_child_private (widget_class, DiaLineChooserPopover, list);
+  gtk_widget_class_bind_template_child_private (widget_class, DiaLineChooserPopover, length);
+  gtk_widget_class_bind_template_child_private (widget_class, DiaLineChooserPopover, length_box);
 
   g_object_unref (template_file);
 }
@@ -108,14 +108,14 @@ spin_change (GtkSpinButton *sb, gpointer data)
 }
 
 static void
-row_selected (GtkListBox                  *box,
-              GtkListBoxRow               *row,
-              DiaLineStyleSelectorPopover *self)
+row_selected (GtkListBox            *box,
+              GtkListBoxRow         *row,
+              DiaLineChooserPopover *self)
 {
-  DiaLineStyleSelectorPopoverPrivate *priv = dia_line_style_selector_popover_get_instance_private (self);
+  DiaLineChooserPopoverPrivate *priv = dia_line_chooser_popover_get_instance_private (self);
 
   int state;
-  state = dia_line_style_selector_popover_get_line_style (self, NULL)
+  state = dia_line_chooser_popover_get_line_style (self, NULL)
      != LINESTYLE_SOLID;
 
   gtk_widget_set_sensitive (priv->length_box, state);
@@ -124,9 +124,9 @@ row_selected (GtkListBox                  *box,
 }
 
 static void
-dia_line_style_selector_popover_init (DiaLineStyleSelectorPopover *self)
+dia_line_chooser_popover_init (DiaLineChooserPopover *self)
 {
-  DiaLineStyleSelectorPopoverPrivate *priv = dia_line_style_selector_popover_get_instance_private (self);
+  DiaLineChooserPopoverPrivate *priv = dia_line_chooser_popover_get_instance_private (self);
 
   gtk_widget_init_template (GTK_WIDGET (self));
 
diff --git a/lib/widgets/dia-line-chooser-popover.h b/lib/widgets/dia-line-chooser-popover.h
new file mode 100644
index 00000000..164c4032
--- /dev/null
+++ b/lib/widgets/dia-line-chooser-popover.h
@@ -0,0 +1,28 @@
+#ifndef __DIALSSPOPOVER_H__
+#define __DIALSSPOPOVER_H__
+
+#include <glib.h>
+#include <gtk/gtk.h>
+
+#include "dia-enums.h"
+
+G_BEGIN_DECLS
+
+#define DIA_TYPE_LINE_CHOOSER_POPOVER (dia_line_chooser_popover_get_type ())
+G_DECLARE_DERIVABLE_TYPE (DiaLineChooserPopover, dia_line_chooser_popover, DIA, LINE_CHOOSER_POPOVER, 
GtkPopover)
+
+struct _DiaLineChooserPopoverClass {
+  GtkPopoverClass parent_class;
+};
+
+GtkWidget *dia_line_chooser_popover_new                  ();
+LineStyle  dia_line_chooser_popover_get_line_style       (DiaLineChooserPopover *self,
+                                                          gdouble               *length);
+void       dia_line_chooser_popover_set_line_style       (DiaLineChooserPopover *self,
+                                                          LineStyle              line_style);
+void       dia_line_chooser_popover_set_length           (DiaLineChooserPopover *self,
+                                                          gdouble                length);
+
+G_END_DECLS
+
+#endif
diff --git a/lib/dia-line-style-selector.c b/lib/widgets/dia-line-chooser.c
similarity index 72%
rename from lib/dia-line-style-selector.c
rename to lib/widgets/dia-line-chooser.c
index 865f0b9d..7f1ef971 100644
--- a/lib/dia-line-style-selector.c
+++ b/lib/widgets/dia-line-chooser.c
@@ -23,8 +23,8 @@
 #include "intl.h"
 #include "widgets.h"
 #include "diaoptionmenu.h"
-#include "dia-line-style-selector.h"
-#include "dia-line-style-selector-popover.h"
+#include "dia-line-chooser.h"
+#include "dia-line-chooser-popover.h"
 
 /************* DiaLinePreview: ***************/
 
@@ -143,17 +143,17 @@ dia_line_preview_get_line_style (DiaLinePreview *self)
   return self->lstyle;
 }
 
-/************* DiaLineStyleSelector: ***************/
+/************* DiaLineChooser: ***************/
 
-typedef struct _DiaLineStyleSelectorPrivate DiaLineStyleSelectorPrivate;
+typedef struct _DiaLineChooserPrivate DiaLineChooserPrivate;
 
-struct _DiaLineStyleSelectorPrivate {
+struct _DiaLineChooserPrivate {
   GtkWidget *popover;
   GtkWidget *preview;
 };
 
-G_DEFINE_TYPE_WITH_CODE (DiaLineStyleSelector, dia_line_style_selector, GTK_TYPE_MENU_BUTTON,
-                         G_ADD_PRIVATE (DiaLineStyleSelector))
+G_DEFINE_TYPE_WITH_CODE (DiaLineChooser, dia_line_chooser, GTK_TYPE_MENU_BUTTON,
+                         G_ADD_PRIVATE (DiaLineChooser))
 
 enum {
     DLS_VALUE_CHANGED,
@@ -163,7 +163,7 @@ enum {
 static guint dls_signals[DLS_LAST_SIGNAL] = { 0 };
 
 static void
-dia_line_style_selector_class_init (DiaLineStyleSelectorClass *class)
+dia_line_chooser_class_init (DiaLineChooserClass *class)
 {
   dls_signals[DLS_VALUE_CHANGED]
       = g_signal_new("value-changed",
@@ -175,11 +175,11 @@ dia_line_style_selector_class_init (DiaLineStyleSelectorClass *class)
 }
 
 static void
-value_changed (GObject *src, DiaLineStyleSelector *self)
+value_changed (GObject *src, DiaLineChooser *self)
 {
-  DiaLineStyleSelectorPrivate *priv = dia_line_style_selector_get_instance_private (self);
+  DiaLineChooserPrivate *priv = dia_line_chooser_get_instance_private (self);
   gdouble length;
-  LineStyle style = dia_line_style_selector_popover_get_line_style (DIA_LINE_STYLE_SELECTOR_POPOVER 
(priv->popover),
+  LineStyle style = dia_line_chooser_popover_get_line_style (DIA_LINE_CHOOSER_POPOVER (priv->popover),
                                                                     &length);
   dia_line_preview_set_line_style (DIA_LINE_PREVIEW (priv->preview), style, length);
 
@@ -188,10 +188,10 @@ value_changed (GObject *src, DiaLineStyleSelector *self)
 }
 
 static void
-dia_line_style_selector_init (DiaLineStyleSelector *self)
+dia_line_chooser_init (DiaLineChooser *self)
 {
   GtkWidget *box;
-  DiaLineStyleSelectorPrivate *priv = dia_line_style_selector_get_instance_private (self);
+  DiaLineChooserPrivate *priv = dia_line_chooser_get_instance_private (self);
 
   box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 16);
   gtk_widget_show (box);
@@ -201,8 +201,8 @@ dia_line_style_selector_init (DiaLineStyleSelector *self)
   gtk_widget_show (priv->preview);
   gtk_box_pack_start (GTK_BOX (box), priv->preview, TRUE, TRUE, 0);
  
-  priv->popover = dia_line_style_selector_popover_new ();
-  dia_line_style_selector_popover_set_line_style (DIA_LINE_STYLE_SELECTOR_POPOVER (priv->popover),
+  priv->popover = dia_line_chooser_popover_new ();
+  dia_line_chooser_popover_set_line_style (DIA_LINE_CHOOSER_POPOVER (priv->popover),
                                                   DEFAULT_LINESTYLE);
   g_signal_connect (G_OBJECT (priv->popover), "value-changed",
                     G_CALLBACK (value_changed), self);
@@ -210,31 +210,31 @@ dia_line_style_selector_init (DiaLineStyleSelector *self)
 }
 
 GtkWidget *
-dia_line_style_selector_new ()
+dia_line_chooser_new ()
 {
-  return g_object_new (DIA_TYPE_LINE_STYLE_SELECTOR, NULL);
+  return g_object_new (DIA_TYPE_LINE_CHOOSER, NULL);
 }
 
 void 
-dia_line_style_selector_get_line_style (DiaLineStyleSelector *self,
-                                        LineStyle            *ls,
-                                        gdouble              *dl)
+dia_line_chooser_get_line_style (DiaLineChooser *self,
+                                 LineStyle       *ls,
+                                 gdouble         *dl)
 {
-  DiaLineStyleSelectorPrivate *priv = dia_line_style_selector_get_instance_private (self);
+  DiaLineChooserPrivate *priv = dia_line_chooser_get_instance_private (self);
 
-  *ls = dia_line_style_selector_popover_get_line_style (DIA_LINE_STYLE_SELECTOR_POPOVER (priv->popover),
+  *ls = dia_line_chooser_popover_get_line_style (DIA_LINE_CHOOSER_POPOVER (priv->popover),
                                                         (gdouble *) dl);
 }
 
 void
-dia_line_style_selector_set_line_style (DiaLineStyleSelector *self,
-                                        LineStyle             linestyle,
-                                        gdouble               dashlength)
+dia_line_chooser_set_line_style (DiaLineChooser *self,
+                                 LineStyle       linestyle,
+                                 gdouble         dashlength)
 {
-  DiaLineStyleSelectorPrivate *priv = dia_line_style_selector_get_instance_private (self);
+  DiaLineChooserPrivate *priv = dia_line_chooser_get_instance_private (self);
 
-  dia_line_style_selector_popover_set_line_style (DIA_LINE_STYLE_SELECTOR_POPOVER (priv->popover),
+  dia_line_chooser_popover_set_line_style (DIA_LINE_CHOOSER_POPOVER (priv->popover),
                                                   linestyle);
-  dia_line_style_selector_popover_set_length (DIA_LINE_STYLE_SELECTOR_POPOVER (priv->popover),
+  dia_line_chooser_popover_set_length (DIA_LINE_CHOOSER_POPOVER (priv->popover),
                                               dashlength);
 }
diff --git a/lib/widgets/dia-line-chooser.h b/lib/widgets/dia-line-chooser.h
new file mode 100644
index 00000000..086ceb2c
--- /dev/null
+++ b/lib/widgets/dia-line-chooser.h
@@ -0,0 +1,48 @@
+#ifndef __DIALSS_H__
+#define __DIALSS_H__
+
+#include <glib.h>
+#include <gtk/gtk.h>
+
+#include "dia-enums.h"
+
+G_BEGIN_DECLS
+
+/* --------------- DiaLinePreview -------------------------------- */
+
+#define DIA_TYPE_LINE_PREVIEW (dia_line_preview_get_type ())
+G_DECLARE_FINAL_TYPE (DiaLinePreview, dia_line_preview, DIA, LINE_PREVIEW, GtkWidget)
+
+struct _DiaLinePreview
+{
+  GtkWidget parent;
+  LineStyle lstyle;
+  gdouble   length;
+};
+
+GtkWidget *dia_line_preview_new            (LineStyle       lstyle);
+LineStyle  dia_line_preview_get_line_style (DiaLinePreview *self);
+void       dia_line_preview_set_line_style (DiaLinePreview *self,
+                                            LineStyle       lstyle,
+                                            gdouble         length);
+
+/* --------------- DiaLineChooser -------------------------------- */
+
+#define DIA_TYPE_LINE_CHOOSER (dia_line_chooser_get_type ())
+G_DECLARE_DERIVABLE_TYPE (DiaLineChooser, dia_line_chooser, DIA, LINE_CHOOSER, GtkMenuButton)
+
+struct _DiaLineChooserClass {
+  GtkMenuButtonClass parent_class;
+};
+
+GtkWidget *dia_line_chooser_new            (void);
+void       dia_line_chooser_get_line_style (DiaLineChooser *as,
+                                            LineStyle      *linestyle, 
+                                            gdouble        *dashlength);
+void       dia_line_chooser_set_line_style (DiaLineChooser *as,
+                                            LineStyle       linestyle,
+                                            gdouble         dashlength);
+
+G_END_DECLS
+
+#endif


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