Commit e509112a authored by Johannes Schmid's avatar Johannes Schmid

project-wizard: Improve UI for PkgConfigChooser

Use the integrated checkboxes in the list and fix all wizard files to
use the new format. Also remove the deprecated gnome-applet wizard.
parent 26287d38
...@@ -449,17 +449,30 @@ cb_druid_add_property (NPWProperty* property, gpointer user_data) ...@@ -449,17 +449,30 @@ cb_druid_add_property (NPWProperty* property, gpointer user_data)
gtk_widget_set_tooltip_text (entry, description); gtk_widget_set_tooltip_text (entry, description);
} }
/* Add label and entry */
gtk_table_resize (data->table, data->row + 1, 2);
label = gtk_label_new (npw_property_get_label (property)); label = gtk_label_new (npw_property_get_label (property));
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
gtk_misc_set_padding (GTK_MISC (label), 6, 6); gtk_misc_set_padding (GTK_MISC (label), 6, 6);
gtk_table_attach (data->table, label, 0, 1, data->row, data->row + 1,
(GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(0), 0, 0);
gtk_table_attach (data->table, entry, 1, 2, data->row, data->row + 1,
(GtkAttachOptions)(GTK_EXPAND|GTK_FILL), (GtkAttachOptions)(0), 0, 0);
data->row++; switch (npw_property_get_type (property))
{
case NPW_PACKAGE_PROPERTY:
gtk_table_resize (data->table, data->row + 2, 1);
gtk_table_attach (data->table, label, 0, 1, data->row, data->row + 1,
(GtkAttachOptions)(GTK_FILL), 0, 0, 0);
gtk_table_attach (data->table, entry, 0, 1, data->row + 1, data->row + 2,
(GtkAttachOptions)(GTK_EXPAND|GTK_FILL),
(GtkAttachOptions)(GTK_EXPAND|GTK_FILL), 0, 0);
data->row += 2;
break;
default:
/* Add label and entry */
gtk_table_resize (data->table, data->row + 1, 2);
gtk_table_attach (data->table, label, 0, 1, data->row, data->row + 1,
(GtkAttachOptions)(GTK_FILL), 0, 0, 0);
gtk_table_attach (data->table, entry, 1, 2, data->row, data->row + 1,
(GtkAttachOptions)(GTK_EXPAND|GTK_FILL), 0, 0, 0);
data->row++;
}
/* Set first entry */ /* Set first entry */
if (data->first_entry == NULL) data->first_entry = entry; if (data->first_entry == NULL) data->first_entry = entry;
......
...@@ -347,7 +347,6 @@ static void ...@@ -347,7 +347,6 @@ static void
cb_browse_button_clicked (GtkButton *button, NPWProperty* prop) cb_browse_button_clicked (GtkButton *button, NPWProperty* prop)
{ {
GtkWidget *dialog; GtkWidget *dialog;
GtkWidget *list;
switch (prop->type) switch (prop->type)
{ {
...@@ -367,55 +366,13 @@ cb_browse_button_clicked (GtkButton *button, NPWProperty* prop) ...@@ -367,55 +366,13 @@ cb_browse_button_clicked (GtkButton *button, NPWProperty* prop)
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
NULL); NULL);
break; break;
case NPW_PACKAGE_PROPERTY:
{
GtkWidget *scroll_window;
GtkWidget *content_area;
GtkWidget *action_area;
dialog = gtk_dialog_new_with_buttons (_("Select package"),
GTK_WINDOW (gtk_widget_get_ancestor (prop->widget, GTK_TYPE_WINDOW)),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CANCEL,
GTK_RESPONSE_REJECT,
GTK_STOCK_ADD,
GTK_RESPONSE_ACCEPT,
NULL);
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
gtk_box_set_spacing (GTK_BOX (content_area), 2);
gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
gtk_window_set_default_size (GTK_WINDOW (dialog), 600, 500);
scroll_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll_window), GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (content_area), scroll_window);
list = anjuta_pkg_config_chooser_new ();
anjuta_pkg_config_chooser_show_active_column (ANJUTA_PKG_CONFIG_CHOOSER (list), FALSE);
gtk_container_add (GTK_CONTAINER (scroll_window), list);
gtk_widget_show_all (dialog);
break;
}
default: default:
g_return_if_reached (); g_return_if_reached ();
} }
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
{ {
gchar *name; gchar* name = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
if (prop->type == NPW_PACKAGE_PROPERTY)
{
name = anjuta_pkg_config_chooser_get_selected_package (ANJUTA_PKG_CONFIG_CHOOSER (list));
}
else
{
name = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
}
gtk_entry_set_text (GTK_ENTRY (prop->widget), name); gtk_entry_set_text (GTK_ENTRY (prop->widget), name);
g_free (name); g_free (name);
} }
...@@ -599,19 +556,15 @@ npw_property_create_widget (NPWProperty* prop) ...@@ -599,19 +556,15 @@ npw_property_create_widget (NPWProperty* prop)
} }
case NPW_PACKAGE_PROPERTY: case NPW_PACKAGE_PROPERTY:
{ {
GtkWidget *button; GtkWidget *scroll_window;
scroll_window = gtk_scrolled_window_new (NULL, NULL);
// Use an entry box and a browse button gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll_window), GTK_SHADOW_IN);
widget = gtk_hbox_new (FALSE, 3);
entry = gtk_entry_new (); entry = anjuta_pkg_config_chooser_new ();
if (value) gtk_entry_set_text (GTK_ENTRY (entry), value); anjuta_pkg_config_chooser_show_active_column (ANJUTA_PKG_CONFIG_CHOOSER (entry), TRUE);
gtk_container_add (GTK_CONTAINER (widget), entry); gtk_container_add (GTK_CONTAINER (scroll_window), entry);
button = gtk_button_new_from_stock (GTK_STOCK_ADD); widget = scroll_window;
g_signal_connect (button, "clicked", G_CALLBACK (cb_browse_button_clicked), prop);
gtk_container_add (GTK_CONTAINER (widget), button);
gtk_box_set_child_packing (GTK_BOX (widget), button, FALSE, TRUE, 0, GTK_PACK_END);
break; break;
} }
default: default:
...@@ -678,6 +631,9 @@ npw_property_set_value_from_widget (NPWProperty* prop, NPWValueTag tag) ...@@ -678,6 +631,9 @@ npw_property_set_value_from_widget (NPWProperty* prop, NPWValueTag tag)
{ {
gchar* alloc_value = NULL; gchar* alloc_value = NULL;
const gchar* value = NULL; const gchar* value = NULL;
GList* packages;
GList* node;
GString* str_value;
gboolean ok; gboolean ok;
switch (prop->type) switch (prop->type)
...@@ -729,7 +685,22 @@ npw_property_set_value_from_widget (NPWProperty* prop, NPWValueTag tag) ...@@ -729,7 +685,22 @@ npw_property_set_value_from_widget (NPWProperty* prop, NPWValueTag tag)
break; break;
} }
case NPW_PACKAGE_PROPERTY: case NPW_PACKAGE_PROPERTY:
value = gtk_entry_get_text (GTK_ENTRY (prop->widget)); packages =
anjuta_pkg_config_chooser_get_active_packages (ANJUTA_PKG_CONFIG_CHOOSER (prop->widget));
str_value = NULL;
for (node = packages; node != NULL; node = g_list_next (node))
{
if (str_value)
{
g_string_append_printf (str_value, " %s", (gchar*) node->data);
}
else
str_value = g_string_new (node->data);
}
value = str_value->str;
g_string_free (str_value, FALSE);
g_list_foreach (packages, (GFunc) g_free, NULL);
g_list_free (packages);
break; break;
default: default:
/* Hidden property */ /* Hidden property */
......
SUBDIRS = minimal terminal cpp gtk anjuta-plugin \ SUBDIRS = minimal terminal cpp gtk anjuta-plugin \
gtkmm wxwin xlib xlib-dock gcj java gnome-applet\ gtkmm wxwin xlib xlib-dock gcj java
python mkfile sdl library directory licenses m4 js_minimal python mkfile sdl library directory licenses m4 js_minimal
template_in_files = \ template_in_files = \
...@@ -20,7 +20,6 @@ template_in_files = \ ...@@ -20,7 +20,6 @@ template_in_files = \
python.wiz.in \ python.wiz.in \
mkfile.wiz.in \ mkfile.wiz.in \
sdl.wiz.in \ sdl.wiz.in \
gnome-applet.wiz.in \
library.wiz.in library.wiz.in
wizard_filesdir = $(anjuta_data_dir)/project wizard_filesdir = $(anjuta_data_dir)/project
......
...@@ -45,11 +45,7 @@ ...@@ -45,11 +45,7 @@
<page name="packages" _label="Configure external packages" _description="Configure external packages"> <page name="packages" _label="Configure external packages" _description="Configure external packages">
<property type="boolean" name="HaveLangCPP" _label="Add C++ support:" _description="Adds C++ support to the project so that C++ source files can be built" default="0"/> <property type="boolean" name="HaveLangCPP" _label="Add C++ support:" _description="Adds C++ support to the project so that C++ source files can be built" default="0"/>
[+IF (=(get "HavePackage") "1")+] [+IF (=(get "HavePackage") "1")+]
<property type="package" name="PackageModule1" _label="Require Package:" _description="Give a package name that your project require. You may also mention what is the required version of the package. For example, 'libgnomeui-2.0' or 'libgnomeui-2.0 &gt;= 2.2.0'" mandatory="yes"/> <property type="package" name="PackageModule1" _label="Required Packages:" _description="Check the packages that your project requires" mandatory="yes"/>
<property type="package" name="PackageModule2" _label="Require Package:" _description="Give a package name that your project require. You may also mention what is the required version of the package. For example, 'libgnomeui-2.0' or 'libgnomeui-2.0 &gt;= 2.2.0'"/>
<property type="package" name="PackageModule3" _label="Require Package:" _description="Give a package name that your project require. You may also mention what is the required version of the package. For example, 'libgnomeui-2.0' or 'libgnomeui-2.0 &gt;= 2.2.0'"/>
<property type="package" name="PackageModule4" _label="Require Package:" _description="Give a package name that your project require. You may also mention what is the required version of the package. For example, 'libgnomeui-2.0' or 'libgnomeui-2.0 &gt;= 2.2.0'"/>
<property type="package" name="PackageModule5" _label="Require Package:" _description="Give a package name that your project require. You may also mention what is the required version of the package. For example, 'libgnomeui-2.0' or 'libgnomeui-2.0 &gt;= 2.2.0'"/>
[+ENDIF+] [+ENDIF+]
</page> </page>
......
...@@ -33,7 +33,7 @@ AM_PROG_LIBTOOL ...@@ -33,7 +33,7 @@ AM_PROG_LIBTOOL
PKG_CHECK_MODULES(LIBANJUTA, [libanjuta-1.0]) PKG_CHECK_MODULES(LIBANJUTA, [libanjuta-1.0])
[+IF (=(get "HavePackage") "1")+] [+IF (=(get "HavePackage") "1")+]
PKG_CHECK_MODULES([+NameCUpper+], [[+PackageModule1+] [+PackageModule2+] [+PackageModule3+] [+PackageModule4+] [+PackageModule5+]]) PKG_CHECK_MODULES([+NameCUpper+], [[+PackageModule1+] [+PackageModule2+]])
AC_SUBST([+NameCUpper+]_CFLAGS) AC_SUBST([+NameCUpper+]_CFLAGS)
AC_SUBST([+NameCUpper+]_LIBS) AC_SUBST([+NameCUpper+]_LIBS)
[+ENDIF+] [+ENDIF+]
......
...@@ -34,15 +34,11 @@ ...@@ -34,15 +34,11 @@
<property type="boolean" name="HavePackage" _label="Configure external packages:" _description="Use pkg-config to add library support from other packages" default="0"/> <property type="boolean" name="HavePackage" _label="Configure external packages:" _description="Use pkg-config to add library support from other packages" default="0"/>
</page> </page>
[+IF (=(get "HavePackage") "1")+]
<page name="packages" _label="Configure external packages" _description="Configure external packages"> <page name="packages" _label="Configure external packages" _description="Configure external packages">
<property type="package" name="PackageModule1" _label="Require Package:" _description="Give a package name that your project require. You may also mention what is the required version of the package. For example, 'libgnomeui-2.0' or 'libgnomeui-2.0 &gt;= 2.2.0'" mandatory="yes"/> [+IF (=(get "HavePackage") "1")+]
<property type="package" name="PackageModule2" _label="Require Package:" _description="Give a package name that your project require. You may also mention what is the required version of the package. For example, 'libgnomeui-2.0' or 'libgnomeui-2.0 &gt;= 2.2.0'"/> <property type="package" name="PackageModule1" _label="Required Packages:" _description="Check the packages that your project requires" mandatory="yes"/>
<property type="package" name="PackageModule3" _label="Require Package:" _description="Give a package name that your project require. You may also mention what is the required version of the package. For example, 'libgnomeui-2.0' or 'libgnomeui-2.0 &gt;= 2.2.0'"/>
<property type="package" name="PackageModule4" _label="Require Package:" _description="Give a package name that your project require. You may also mention what is the required version of the package. For example, 'libgnomeui-2.0' or 'libgnomeui-2.0 &gt;= 2.2.0'"/>
<property type="package" name="PackageModule5" _label="Require Package:" _description="Give a package name that your project require. You may also mention what is the required version of the package. For example, 'libgnomeui-2.0' or 'libgnomeui-2.0 &gt;= 2.2.0'"/>
</page>
[+ENDIF+] [+ENDIF+]
</page>
<content> <content>
<directory source="terminal" destination="[+Destination+]"> <directory source="terminal" destination="[+Destination+]">
......
...@@ -32,7 +32,7 @@ AM_PROG_LIBTOOL ...@@ -32,7 +32,7 @@ AM_PROG_LIBTOOL
[+ENDIF+] [+ENDIF+]
[+IF (=(get "HavePackage") "1")+] [+IF (=(get "HavePackage") "1")+]
PKG_CHECK_MODULES([+NameCUpper+], [[+PackageModule1+] [+PackageModule2+] [+PackageModule3+] [+PackageModule4+] [+PackageModule5+]]) PKG_CHECK_MODULES([+NameCUpper+], [[+PackageModule1+] [+PackageModule2+]])
[+ENDIF+] [+ENDIF+]
[+IF (=(get "HaveGtkDoc") "1")+] [+IF (=(get "HaveGtkDoc") "1")+]
......
...@@ -37,15 +37,11 @@ ...@@ -37,15 +37,11 @@
<property type="boolean" name="HavePackageExtra" _label="Configure external packages:" _description="Use pkg-config to add library support from other packages" default="0"/> <property type="boolean" name="HavePackageExtra" _label="Configure external packages:" _description="Use pkg-config to add library support from other packages" default="0"/>
</page> </page>
[+IF (=(get "HavePackageExtra") "1")+]
<page name="packages" _label="Configure external packages" _description="Configure external packages"> <page name="packages" _label="Configure external packages" _description="Configure external packages">
<property type="package" name="PackageModule1" _label="Require Package:" _description="Give a package name that your project require. You may also mention what is the required version of the package. For example, 'libgnomeui-2.0' or 'libgnomeui-2.0 &gt;= 2.2.0'" mandatory="yes"/> [+IF (=(get "HavePackage") "1")+]
<property type="package" name="PackageModule2" _label="Require Package:" _description="Give a package name that your project require. You may also mention what is the required version of the package. For example, 'libgnomeui-2.0' or 'libgnomeui-2.0 &gt;= 2.2.0'" mandatory="yes"/> <property type="package" name="PackageModule1" _label="Required Packages:" _description="Check the packages that your project requires" mandatory="yes"/>
<property type="package" name="PackageModule3" _label="Require Package:" _description="Give a package name that your project require. You may also mention what is the required version of the package. For example, 'libgnomeui-2.0' or 'libgnomeui-2.0 &gt;= 2.2.0'"/>
<property type="package" name="PackageModule4" _label="Require Package:" _description="Give a package name that your project require. You may also mention what is the required version of the package. For example, 'libgnomeui-2.0' or 'libgnomeui-2.0 &gt;= 2.2.0'"/>
<property type="package" name="PackageModule5" _label="Require Package:" _description="Give a package name that your project require. You may also mention what is the required version of the package. For example, 'libgnomeui-2.0' or 'libgnomeui-2.0 &gt;= 2.2.0'"/>
</page>
[+ENDIF+] [+ENDIF+]
</page>
<content> <content>
<directory source="terminal" destination="[+Destination+]"> <directory source="terminal" destination="[+Destination+]">
......
...@@ -24,7 +24,7 @@ IT_PROG_INTLTOOL([0.35.0]) ...@@ -24,7 +24,7 @@ IT_PROG_INTLTOOL([0.35.0])
[+ENDIF+] [+ENDIF+]
[+IF (=(get "HavePackage") "1")+] [+IF (=(get "HavePackage") "1")+]
PKG_CHECK_MODULES([+NameCUpper+], [[+PackageModule1+] [+PackageModule2+] [+PackageModule3+] [+PackageModule4+] [+PackageModule5+]]) PKG_CHECK_MODULES([+NameCUpper+], [[+PackageModule1+] [+PackageModule2+]])
[+ENDIF+] [+ENDIF+]
AC_OUTPUT([ AC_OUTPUT([
......
<project-template>
<project-wizard>
<_name>GNOME Applet</_name>
<_description>A GNOME applet project</_description>
<icon>gnome-logo.png</icon>
<category>C</category>
<required-program>automake</required-program>
<required-program>autoconf</required-program>
<required-program>make</required-program>
<required-package>libpanelapplet-2.0 >= 2.14</required-package>
</project-wizard>
<page name="basic" _label="Basic information" _description="General Project Information">
<property type="string" name="Name" _label="Project Name:" _description="project name" default="gnome-applet" summary="yes" restriction="filename" mandatory="yes"/>
<property type="string" name="Author" _label="Author:" _description="" default="[+UserName+]" mandatory="yes"/>
<property type="string" name="Email" _label="Email address:" _description="" default="[+EmailAddress+]" mandatory="no"/>
<property type="string" name="Version" _label="Version:" default="0.1" mandatory="yes"/>
</page>
<page name="options" _label="Project options" _description="Options for project build system">
<property type="directory" name="Destination" _label="Destination:" _description="" default='[+AnjutaProjectDirectory+]/[+(string-downcase (get "Name"))+]' mandatory="yes" exist="no" restriction="directory" summary="yes"/>
<property type="list" name="License" _label="License" _description="Select code license" default="GPL" editable="no">
<item name="GPL" _label="General Public License (GPL)"/>
<item name="LGPL" _label="Lesser General Public License (LGPL)"/>
<item name="BSD" _label="Berkeley Software Distribution License (BSD)"/>
<item name="None" _label="No license"/>
</property>
<property type="hidden" name="NameUpper" default='[+(string-upcase (get "Name"))+]'/>
<property type="hidden" name="NameLower" default='[+(string-downcase (get "Name"))+]'/>
<property type="hidden" name="NameCUpper" default='[+(string->c-name! (string-substitute (string-upcase (get "Name")) " " "_"))+]'/>
<property type="hidden" name="NameCLower" default='[+(string->c-name! (string-substitute (string-downcase (get "Name")) " " "_"))+]'/>
<property type="hidden" name="NameHLower" default='[+(string-substitute (string->c-name! (string-downcase (get "Name"))) " " "-")+]'/>
<property type="hidden" name="HavePackage" default="1"/>
<property type="icon" name="Icon" _label="Icon File:" _description="Icon file for the plugin" summary="yes" mandatory="yes"/>
<property type="string" name="Title" _label="Applet Title:" _description="Display title of the applet" default="GNOME Applet" summary="yes" mandatory="yes"/>
<property type="string" name="Description" _label="Description:" _description="Display description of the applet" default="A sample demonstration GNOME applet created by Anjuta" summary="yes" mandatory="yes"/>
<property type="hidden" name="PackageModule1" default="libpanelapplet-2.0 >= 2.14"/>
<property type="boolean" name="HaveLangCPP" _label="Add C++ support:" _description="Adds C++ support to the project so that C++ source files can be built" default="0"/>
<property type="boolean" name="HaveI18n" _label="Add internationalization:" _description="Adds support for internationalization so that your project can have translations in different languages" default="1"/>
<property type="boolean" name="HavePackageExtra" _label="Configure external packages:" _description="Use pkg-config to add library support from other packages" default="0"/>
</page>
[+IF (=(get "HavePackageExtra") "1")+]
<page name="packages" _label="Configure external packages" _description="Configure external packages">
<property type="package" name="PackageModule2" _label="Require Package:" _description="Give a package name that your project require. You may also mention what is the required version of the package. For example, 'libgnomeui-2.0' or 'libgnomeui-2.0 &gt;= 2.2.0'" mandatory="yes"/>
<property type="package" name="PackageModule3" _label="Require Package:" _description="Give a package name that your project require. You may also mention what is the required version of the package. For example, 'libgnomeui-2.0' or 'libgnomeui-2.0 &gt;= 2.2.0'"/>
<property type="package" name="PackageModule4" _label="Require Package:" _description="Give a package name that your project require. You may also mention what is the required version of the package. For example, 'libgnomeui-2.0' or 'libgnomeui-2.0 &gt;= 2.2.0'"/>
<property type="package" name="PackageModule5" _label="Require Package:" _description="Give a package name that your project require. You may also mention what is the required version of the package. For example, 'libgnomeui-2.0' or 'libgnomeui-2.0 &gt;= 2.2.0'"/>
</page>
[+ENDIF+]
<content>
<directory source="terminal" destination="[+Destination+]">
<file source="AUTHORS"/>
<file source="ChangeLog"/>
<file source="NEWS"/>
<file source="README"/>
<file destination="[+NameHLower+].anjuta" source="project.anjuta"/>
<file source="cvsignore" destination=".cvsignore"/>
<directory source="src">
<file source="cvsignore" destination=".cvsignore"/>
</directory>
[+IF (=(get "HaveI18n") "1") +]
<directory source="po">
<file source="ChangeLog"/>
<file source="POTFILES.in"/>
<file source="LINGUAS" />
<file source="cvsignore" destination=".cvsignore"/>
</directory>
[+ENDIF+]
</directory>
<directory source="." destination="[+Destination+]">
<directory source="m4">
<file source="as-ac-expand.m4"/>
<file source="ac-define-dir.m4"/>
</directory>
</directory>
<directory source="gnome-applet" destination="[+Destination+]">
<file source="configure.ac.tpl" destination="configure.ac"/>
<file source="Makefile.am.tpl" destination="Makefile.am"/>
<file source="autogen.sh" executable="yes"/>
<file source="HACKING"/>
<directory source="src">
<file source="main.c"/>
<file source="GNOME_Applet.server.in.in" destination="[+Name+].server.in.in"/>
<file source="Makefile.am.tpl" destination="Makefile.am"/>
</directory>
</directory>
<directory source="licenses" destination="[+Destination+]">
<file source="[+License+]" destination="COPYING"/>
</directory>
<directory source="minimal" destination="[+Destination+]">
<directory source="." destination=".anjuta">
<directory source="." destination="session">
<file source="anjuta.session"/>
</directory>
</directory>
</directory>
</content>
<action>
<open file="[+Destination+]/[+NameHLower+].anjuta"/>
</action>
</project-template>
Some tips for hacking/debugging the applets:
1) The Panel Applet Writer's Reference Manual, including the PanelApplet
library documentation, can be found at
http://developer.gnome.org/doc/API/2.0/panel-applet/libpanel-applet.html,
or in gnome-panel/doc/reference/panel-applet (source). It is not
completely up to date, but it covers the basics of writing an applet.
2) Look at the other applet implementations. One of the simpler applets is
the fish applet, which lives in gnome-panel/applets/fish.
3) Read the article about debugging GNOME Applets at
http://www.davyd.id.au/articles/debugging-gnome-applets.shtml.
This article also contains a list of common considerations when developing
applets. Please, please read this article, it covers everything you're
likely to need to know. If you find anything is missing, then contact
the maintainers.
4) Be weary of static, global variables if you plan to allow the user
to be able to add multiple instances of the applet. Each instance will
share the static varible. This is described in the debugging article, under
"Other considerations".
5) You'd probably want to run the applets from CVS, without nescessarily doing
the same with all of GNOME. To do this, install the applets from CVS to a
different prefix than the rest of GNOME, and change your bonobo servers
directory to $prefix/lib/bonobo/servers. You'll find the config file by
running "bonobo-activation-sysconf --config-file-path". Add the directory to
as an <item> at the top of <searchpath>. Log out, run bonobo-slay and make
sure no bonobo processes are running. When you log in again, your applets
should be running from the new prefix.
Running single applets from CVS is described further in Davyd's debugging
article.
SUBDIRS = src po
wizard_filesdir = $(anjuta_data_dir)/project/gnome-applet
wizard_files_DATA = \
configure.ac.tpl \
autogen.sh \
Makefile.am.tpl \
HACKING
EXTRA_DIST = $(wizard_files_DATA)
-include $(top_srcdir)/git.mk
[+ autogen5 template +]
## Process this file with automake to produce Makefile.in
## Created by Anjuta
SUBDIRS = src [+IF (=(get "HaveI18n") "1") +]po[+ENDIF+]
ACLOCAL_AMFLAGS = -I m4
[+NameCLower+]docdir = ${prefix}/doc/[+NameHLower+]
[+NameCLower+]doc_DATA = \
README\
COPYING\
AUTHORS\
ChangeLog\
INSTALL\
NEWS
[+IF (=(get "HaveI18n") "1") +]
INTLTOOL_FILES = intltool-extract.in \
intltool-merge.in \
intltool-update.in
EXTRA_DIST = $([+NameCLower+]doc_DATA) \
$(INTLTOOL_FILES)
DISTCLEANFILES = intltool-extract \
intltool-merge \
intltool-update \
po/.intltool-merge-cache
[+ELSE+]
EXTRA_DIST = $([+NameCLower+]doc_DATA)
[+ENDIF+]
[+ autogen5 template +]
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
PKG_NAME="[+Name+]"
(test -f $srcdir/configure.ac \
&& test -d $srcdir/src) || {
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
echo " top-level $PKG_NAME directory"
exit 1
}
which gnome-autogen.sh || {
echo "You need to install gnome-common from GNOME SVN and make"
echo "sure the gnome-autogen.sh script is in your \$PATH."
exit 1
}
REQUIRED_AUTOMAKE_VERSION=1.9 USE_GNOME2_MACROS=1 . gnome-autogen.sh
[+ autogen5 template +]
dnl Process this file with autoconf to produce a configure script.
dnl Created by Anjuta application wizard.
AC_INIT([+NameHLower+], [+Version+])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
AC_CONFIG_HEADERS([config.h])
AM_MAINTAINER_MODE
AC_PROG_CC
[+IF (=(get "HaveLangCPP") "1")+]
AC_PROG_CPP
AC_PROG_CXX
[+ENDIF+]
[+IF (=(get "HavePackage") "1")+]
PKG_CHECK_MODULES([+NameCUpper+], [[+PackageModule1+] [+PackageModule2+] [+PackageModule3+] [+PackageModule4+] [+PackageModule5+]])
[+ENDIF+]
AS_AC_EXPAND(LIBEXECDIR, $libexecdir)
AC_SUBST(LIBEXECDIR)
[+IF (=(get "HaveI18n") "1")+]
dnl ***************************************************************************
dnl Internatinalization
dnl ***************************************************************************
GETTEXT_PACKAGE=[+NameHLower+]
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [GETTEXT package name])
AC_DEFINE_DIR(GNOMELOCALEDIR, "${datadir}/locale", [locale directory])
AM_GLIB_GNU_GETTEXT
IT_PROG_INTLTOOL([0.35.0])
[+ENDIF+]
AC_OUTPUT([
Makefile
src/Makefile
src/[+Name+].server.in
[+IF (=(get "HaveI18n") "1")+]po/Makefile.in[+ENDIF+]
])
wizard_filesdir = $(anjuta_data_dir)/project/gnome/po
wizard_files_DATA = POTFILES.in
EXTRA_DIST = $(wizard_files_DATA)
-include $(top_srcdir)/git.mk
[+ autogen5 template +]
# List of source files containing translatable strings.
src/main.c
[+ autogen5 template +]
<oaf_info>
<oaf_server iid="OAFIID:[+Name+]Applet_Factory" type="exe" location="@LIBEXECDIR@/[+NameHLower+]">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:Bonobo/GenericFactory:1.0"/>
<item value="IDL:Bonobo/Unknown:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string" value="[+Title+] applet Factory"/>
<oaf_attribute name="description" type="string" value="[+Description+]"/>
</oaf_server>
<oaf_server iid="OAFIID:[+Name+]Applet" type="factory" location="OAFIID:[+Name+]Applet_Factory">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:GNOME/Vertigo/PanelAppletShell:1.0"/>
<item value="IDL:Bonobo/Control:1.0"/>
<item value="IDL:Bonobo/Unknown:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string" value="[+Title+]"/>
<oaf_attribute name="description" type="string" value="GNOME applet created by Anjuta"/>
<oaf_attribute name="panel:icon" type="string" value="[+Icon+]"/>
</oaf_server>
</oaf_info>
wizard_filesdir = $(anjuta_data_dir)/project/gnome-applet/src
wizard_files_DATA = main.c \
Makefile.am.tpl \
GNOME_Applet.server.in.in
EXTRA_DIST = $(wizard_files_DATA)
-include $(top_srcdir)/git.mk
[+ autogen5 template +]
## Process this file with automake to produce Makefile.in
## Created by Anjuta
AM_CPPFLAGS = \
-DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
-DPACKAGE_SRC_DIR=\""$(srcdir)"\" \
-DPACKAGE_DATA_DIR=\""$(datadir)"\" \
$([+NameCUpper+]_CFLAGS)
AM_CFLAGS =\
-Wall\
-g
libexec_PROGRAMS = [+NameHLower+]
[+NameCLower+]_SOURCES = \
main.c
[+NameCLower+]_LDFLAGS = \
-Wl,--export-dynamic
[+NameCLower+]_LDADD = $([+NameCUpper+]_LIBS)
serverdir = $(libdir)/bonobo/servers
server_in_files = [+Name+].server.in
server_DATA = $(server_in_files:.server.in=.server)
CLEANFILES = $(server_in_files) $(server_DATA)
EXTRA_DIST = \
[+Name+].server.in.in
[+IF (=(get "HaveI18n") "1")+]
%.server: %.server.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po)
LC_ALL=C $(INTLTOOL_MERGE) -s -u -c $(top_buildir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@
[+ELSE+]
%.server: %.server.in
cp $< $@
[+ENDIF+]
# Display a message at the end of install
install-data-hook:
@echo "***"
@echo "*** If you have installed your applet in a non standard directory. You have to"
@echo "*** add it in the bonobo server list, so it can find your applet."
@echo "***"
@echo "*** Run 'bonobo-activation-sysconf --add-directory=$(serverdir)'"
@echo "*** Log out from your current GNOME session"
@echo "*** Run 'bonobo-slay'"
@echo "*** Check that the bonobo server is not running"
@echo "*** Log in again, your applet should be available"
@echo "***"
[+ autogen5 template +]
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
* main.c
* Copyright (C) [+Author+] [+(shell "date +%Y")+] <[+Email+]>
*
[+CASE (get "License") +]
[+ == "BSD" +][+(bsd (get "Name") (get "Author") " * ")+]
[+ == "LGPL" +][+(lgpl (get "Name") (get "Author") " * ")+]
[+ == "GPL" +][+(gpl (get "Name") " * ")+]
[+ESAC+] */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <string.h>
#include <gtk/gtk.h>
#include <panel-applet.h>