Addon for desktop-menu-plugin.c

Brian J. Tarricone bjt23 at cornell.edu
Thu Sep 30 22:04:48 CEST 2004


your implementation is ok, with two exceptions:
1) there's ne need to keep a copy of the pointer to the button in the
DMPlugin struct
2) your use of strcpy() is unsafe.  in this case, since it's a one-off thing,
i'd allocate the string dynamically using g_strdup_printf().  other options
are g_snprintf() or strlcpy()/strlcat() on a static string.

there is no way to make the menu editor open in front of the options dialog
if the panel is set as 'always on top'.  this annoyance alone might lead me
to avoid adding this feature, though i suppose a workaround would be to
programmatically close the setup window when the button is clicked.

i'd commit something similar (actually, i thought about doing this a while
ago but forgot about it), but we're now in string freeze for 4.2, so no
new strings can be added.  although... there's an "edit menu" button in the
MCS dialog which already has a translated string, so we could just use that
one.  i'll look into it when i get home.

	-brian

On 09/30/04 21:26, Jannis Pohlmann wrote:
> Hello!
> 
> I postet a feature request to the XFce forum 
> (http://forum.xfce.org/viewtopic.php?t=1046) and tried
> to edit xfdesktop/panel-plugin/desktop-menu-plugin.c of a current CVS 
> snapshot. I manipulated the
> code as followed:
> 
> typedef struct _DMPlugin {
>    (...)
>    GtkWidget* edit_fb;
>    (...)
> } DMPlugin;
> 
> static void
> editbutton_click_cb(GtkWidget *w, gpointer user_data)
> {
>    DMPlugin *dmp = user_data;
>    char cmd[1024];
>    strcpy(cmd,"xfce4-menueditor ");
>    strcat(cmd, dmp->menu_file);
>    xfce_exec(cmd, FALSE, FALSE, NULL);
> }
> 
> static void
> dmp_create_options(Control *ctrl, GtkContainer *con, GtkWidget *done)
> {
>    (...)
>    gtk_box_pack_start(GTK_BOX(hbox), filebutton, FALSE, FALSE, 0);
>    (...)
>    dmp->edit_fb = editbutton = gtk_button_new_with_label(_("Edit menu"));
>    gtk_container_add(GTK_CONTAINER(editbutton), image);
>    gtk_widget_show(editbutton);
>    gtk_box_pack_end(GTK_BOX(hbox), editbutton, FALSE, FALSE, 0);
>    g_signal_connect(G_OBJECT(editbutton), "clicked",
>            G_CALLBACK(editbutton_click_cb), dmp);
>    (...)
> }
> 
> --
> 1) Is it a common method to run external applaction using xfce_exec()?
> 2) How can one make the now opened menueditor in front of the options 
> dialog
>   (on my system, it is opened in the back of the dialog)?
> 3) If this feature is optimized, is it possible to commit it to the offical
>   XFce4 development tree?
> 
> Greetings,
> Jannis
> _______________________________________________
> Xfce4-dev mailing list
> Xfce4-dev at xfce.org
> http://lunar-linux.org/mailman/listinfo/xfce4-dev



More information about the Xfce4-dev mailing list