@eht16 commented on this pull request.
> + GeanyDocument *doc = document_get_current();
+
+ if (doc != NULL && pin_list == NULL)
+ {
+ GtkWidget *label = gtk_label_new_with_mnemonic(doc->file_name);
+ gtk_widget_show(label);
+ gtk_box_pack_start(GTK_BOX(pinned_view_vbox), label, FALSE,
FALSE, 0);
+
gtk_notebook_set_current_page(GTK_NOTEBOOK(plugin->geany_data->main_widgets->sidebar_notebook),
page_number);
+ }
+}
+
+
+static gboolean pin_init(GeanyPlugin *plugin, gpointer pdata)
+{
+ GtkWidget *main_menu_item;
+ GSList *pin_list = NULL;
Yeah, a third argument doesn't work :(.
The common way is to define a struct to hold the data you want to pass, in this
case the plugin and the pin_list pointers and then allocate, fill and pass the
struct from `pin_init` to `pin_activate_cb` as the `data` argument.
Care should be paid to the allocation of the struct, it might get tricky to
deallocate it in the handler function. I don't remember if GLib offers some
utility function for this.
ALternatively, the struct could be created once per plugin and the carried
around and reused.
To get a rough idea, see
https://github.com/geany/geany-plugins/blob/8431a100f118aacf438af159a4b822469534077f/addons/src/ao_bookmarklist.c#L461.
I didn't test it but maybe you could also use
https://www.geany.org/manual/reference/plugindata_8h.html#a143ba8805bd049f3fb13037fae0eb30a
to add the `pin_list` to the `plugin` instance. I'm not sure if this is a good
idea, it might get clumsy.
--
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/pull/1308#discussion_r1488644428
You are receiving this because you are subscribed to this thread.
Message ID: <geany/geany-plugins/pull/1308/review/[email protected]>