-
-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Let peas chew on v2.0 for python based plugins #595
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,24 +11,42 @@ | |
|
||
#include "popover.h" | ||
|
||
struct BudgiePopover { | ||
GtkWidget * relative_to; | ||
}; | ||
|
||
G_DEFINE_TYPE(BudgiePopover, budgie_popover, GTK_TYPE_POPOVER) | ||
typedef struct { | ||
GtkPopover parent_instance; | ||
} BudgiePopoverPrivate; | ||
|
||
static void budgie_popover_init(BudgiePopover * self){ | ||
G_DEFINE_TYPE_WITH_PRIVATE(BudgiePopover, budgie_popover, GTK_TYPE_POPOVER) | ||
|
||
static void budgie_popover_init(BudgiePopover* self) { | ||
|
||
} | ||
|
||
static void budgie_popover_class_init(BudgiePopoverClass * c) { | ||
(void) c; | ||
static void budgie_popover_dispose (GObject* object) { | ||
BudgiePopover *popover = budgie_popover_get_instance_private(T_BUDGIE_POPOVER (object)); | ||
|
||
G_OBJECT_CLASS(budgie_popover_parent_class)->dispose(object); | ||
} | ||
|
||
static void budgie_popover_finalize (GObject* object) { | ||
BudgiePopover *popover = budgie_popover_get_instance_private(T_BUDGIE_POPOVER (object)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this here? |
||
|
||
G_OBJECT_CLASS(budgie_popover_parent_class)->finalize(object); | ||
} | ||
|
||
GtkWidget * budgie_popover_new(GtkWidget * relative_to) { | ||
GtkWidget * popover = g_object_new(BUDGIE_TYPE_POPOVER, "relative-to", relative_to); | ||
GtkStyleContext * style = gtk_widget_get_style_context(popover); | ||
gtk_style_context_add_class(style, "budgie-popover"); | ||
static void budgie_popover_class_init(BudgiePopoverClass* klass) { | ||
GtkWidgetClass* widget_class = GTK_WIDGET_CLASS(klass); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't look like it's being used. |
||
GObjectClass* object_class = G_OBJECT_CLASS(klass); | ||
|
||
object_class->dispose = budgie_popover_dispose; | ||
object_class->finalize = budgie_popover_finalize; | ||
} | ||
|
||
BudgiePopover* budgie_popover_new(GtkWidget* relative_to) { | ||
BudgiePopover* popover = g_object_new(T_TYPE_BUDGIE_POPOVER, "relative-to", relative_to, NULL); | ||
GtkStyleContext* style = gtk_widget_get_style_context(popover); | ||
|
||
gtk_style_context_add_class(style, "budgie-popover"); | ||
|
||
return popover; | ||
return popover; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ | |
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2.1 of the License, or (at your option) any later version. | ||
* | ||
* based on the template described in https://docs.gtk.org/gobject/tutorial.html | ||
*/ | ||
|
||
#pragma once | ||
|
@@ -16,16 +18,15 @@ | |
|
||
G_BEGIN_DECLS | ||
|
||
G_DECLARE_DERIVABLE_TYPE(BudgiePopover, budgie_popover, BUDGIE, POPOVER, GtkPopover) | ||
#define T_TYPE_BUDGIE_POPOVER (budgie_popover_get_type ()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By modern conventions, the type should be |
||
G_DECLARE_DERIVABLE_TYPE (BudgiePopover, budgie_popover, T, BUDGIE_POPOVER, GtkPopover) | ||
|
||
struct _BudgiePopoverClass { | ||
GtkPopoverClass parent_class; | ||
|
||
gpointer padding[4]; | ||
gpointer padding[12]; | ||
}; | ||
|
||
#define BUDGIE_TYPE_POPOVER (budgie_popover_get_type()) | ||
|
||
GtkWidget* budgie_popover_new(GtkWidget* relative_to); | ||
BudgiePopover* budgie_popover_new(GtkWidget* relative_to); | ||
|
||
G_END_DECLS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also seems wrong. I would look at this class in the trash applet, which is also a derivable type with private data.