enums: Generate enums with standard GLib syntax
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
<summary>Window position</summary>
|
<summary>Window position</summary>
|
||||||
<description>Window position (x and y).</description>
|
<description>Window position (x and y).</description>
|
||||||
</key>
|
</key>
|
||||||
<key name="active-view" enum="org.gnome.calendar.GcalWindowViewType">
|
<key name="active-view" enum="org.gnome.calendar.GcalWindowView">
|
||||||
<default>'month'</default>
|
<default>'month'</default>
|
||||||
<summary>Type of the active view</summary>
|
<summary>Type of the active view</summary>
|
||||||
<description>Type of the active window view, default value is: monthly view</description>
|
<description>Type of the active window view, default value is: monthly view</description>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ G_BEGIN_DECLS
|
|||||||
/*** END file-production ***/
|
/*** END file-production ***/
|
||||||
|
|
||||||
/*** BEGIN enumeration-production ***/
|
/*** BEGIN enumeration-production ***/
|
||||||
#define GCAL_@ENUMSHORT@ (@enum_name@_get_type())
|
#define GCAL_TYPE_@ENUMSHORT@ (@enum_name@_get_type())
|
||||||
GType @enum_name@_get_type (void) G_GNUC_CONST;
|
GType @enum_name@_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
/*** END enumeration-production ***/
|
/*** END enumeration-production ***/
|
||||||
|
|||||||
+1
-1
@@ -38,7 +38,7 @@ typedef enum
|
|||||||
GCAL_WINDOW_VIEW_YEAR,
|
GCAL_WINDOW_VIEW_YEAR,
|
||||||
GCAL_WINDOW_VIEW_LIST,
|
GCAL_WINDOW_VIEW_LIST,
|
||||||
GCAL_WINDOW_VIEW_SEARCH,
|
GCAL_WINDOW_VIEW_SEARCH,
|
||||||
} GcalWindowViewType;
|
} GcalWindowView;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
|||||||
+5
-8
@@ -22,7 +22,6 @@
|
|||||||
#include "gcal-debug.h"
|
#include "gcal-debug.h"
|
||||||
#include "gcal-edit-dialog.h"
|
#include "gcal-edit-dialog.h"
|
||||||
#include "gcal-enums.h"
|
#include "gcal-enums.h"
|
||||||
#include "gcal-enum-types.h"
|
|
||||||
#include "gcal-event-widget.h"
|
#include "gcal-event-widget.h"
|
||||||
#include "gcal-manager.h"
|
#include "gcal-manager.h"
|
||||||
#include "gcal-month-view.h"
|
#include "gcal-month-view.h"
|
||||||
@@ -140,7 +139,7 @@ struct _GcalWindow
|
|||||||
GtkWidget *edit_dialog;
|
GtkWidget *edit_dialog;
|
||||||
|
|
||||||
GcalManager *manager;
|
GcalManager *manager;
|
||||||
GcalWindowViewType active_view;
|
GcalWindowView active_view;
|
||||||
icaltimetype *active_date;
|
icaltimetype *active_date;
|
||||||
|
|
||||||
gboolean rtl;
|
gboolean rtl;
|
||||||
@@ -584,7 +583,7 @@ view_changed (GObject *object,
|
|||||||
GcalWindow *window;
|
GcalWindow *window;
|
||||||
GEnumClass *eklass;
|
GEnumClass *eklass;
|
||||||
GEnumValue *eval;
|
GEnumValue *eval;
|
||||||
GcalWindowViewType view_type;
|
GcalWindowView view_type;
|
||||||
|
|
||||||
window = GCAL_WINDOW (user_data);
|
window = GCAL_WINDOW (user_data);
|
||||||
|
|
||||||
@@ -592,10 +591,8 @@ view_changed (GObject *object,
|
|||||||
if (!gtk_widget_get_visible (window->views_stack))
|
if (!gtk_widget_get_visible (window->views_stack))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
eklass = g_type_class_ref (gcal_window_view_type_get_type ());
|
eklass = g_type_class_ref (GCAL_TYPE_WINDOW_VIEW);
|
||||||
eval = g_enum_get_value_by_nick (
|
eval = g_enum_get_value_by_nick (eklass, gtk_stack_get_visible_child_name (GTK_STACK (window->views_stack)));
|
||||||
eklass,
|
|
||||||
gtk_stack_get_visible_child_name (GTK_STACK (window->views_stack)));
|
|
||||||
|
|
||||||
view_type = eval->value;
|
view_type = eval->value;
|
||||||
|
|
||||||
@@ -1447,7 +1444,7 @@ gcal_window_class_init (GcalWindowClass *klass)
|
|||||||
properties[PROP_ACTIVE_VIEW] = g_param_spec_enum ("active-view",
|
properties[PROP_ACTIVE_VIEW] = g_param_spec_enum ("active-view",
|
||||||
"Active View",
|
"Active View",
|
||||||
"The active view, eg: month, week, etc.",
|
"The active view, eg: month, week, etc.",
|
||||||
GCAL_WINDOW_VIEW_TYPE,
|
GCAL_TYPE_WINDOW_VIEW,
|
||||||
GCAL_WINDOW_VIEW_MONTH,
|
GCAL_WINDOW_VIEW_MONTH,
|
||||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user