Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/panel/plugin_manager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace Budgie {
var repo = GI.Repository.get_default();
repo.require("Peas", "1.0", 0);
repo.require("PeasGtk", "1.0", 0);
repo.require("Budgie", "1.0", 0);
repo.require("Budgie", "2.0", 0);
} catch (Error e) {
message("Error loading typelibs: %s", e.message);
}
Expand Down
42 changes: 30 additions & 12 deletions src/plugin/panel/popover.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Comment on lines +15 to +17
Copy link
Member

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.


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));
Copy link
Member

Choose a reason for hiding this comment

The 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);
Copy link
Member

Choose a reason for hiding this comment

The 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;
}
11 changes: 6 additions & 5 deletions src/plugin/panel/popover.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By modern conventions, the type should be BUDGIE_TYPE_POPOVER.

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
Loading