aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-03-26 10:12:24 -0500
committerTed Gould <ted@canonical.com>2009-03-26 10:12:24 -0500
commit8fd2e25183945f41bc6174d2c5dadb68631e2825 (patch)
tree24c404847f4a5c3e448f9c2af838bf223fa3bee3
parent1ec78fcf904b9d2a555da575d70ac9946bf63ba9 (diff)
parentacc7f891bdccbd58d92b957a20a0cb10f6a7513e (diff)
downloadlibayatana-indicator-8fd2e25183945f41bc6174d2c5dadb68631e2825.tar.gz
libayatana-indicator-8fd2e25183945f41bc6174d2c5dadb68631e2825.tar.bz2
libayatana-indicator-8fd2e25183945f41bc6174d2c5dadb68631e2825.zip
Merging in Eitan's changes to make the applet a GNOME Program
-rw-r--r--configure.ac49
-rw-r--r--src/applet-main.c24
2 files changed, 71 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index cb11502..42d87c6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,7 +39,8 @@ PANEL_REQUIRED_VERSION=2.0.0
DBUS_REQUIRED_VERSION=0.76
PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION
- libpanelapplet-2.0 >= $PANEL_REQUIRED_VERSION)
+ libpanelapplet-2.0 >= $PANEL_REQUIRED_VERSION
+ libgnomeui-2.0)
AC_SUBST(APPLET_CFLAGS)
AC_SUBST(APPLET_LIBS)
@@ -91,6 +92,22 @@ AM_CONDITIONAL(USE_GIR, test "x$gir_ok" = "xyes")
GTK_DOC_CHECK([1.4])
+##############################
+# Custom Junk
+##############################
+
+AC_DEFUN([AC_DEFINE_PATH], [
+ test "x$prefix" = xNONE && prefix="$ac_default_prefix"
+ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+ ac_define_path=`eval echo [$]$2`
+ ac_define_path=`eval echo [$]ac_define_path`
+ $1="$ac_define_path"
+ AC_SUBST($1)
+ ifelse($3, ,
+ AC_DEFINE_UNQUOTED($1, "$ac_define_path"),
+ AC_DEFINE_UNQUOTED($1, "$ac_define_path", $3))
+])
+
###########################
# Internationalization
###########################
@@ -98,9 +115,39 @@ GTK_DOC_CHECK([1.4])
GETTEXT_PACKAGE=indicator-applet
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Name of the default gettext domain])
+AC_DEFINE_PATH(GNOMELOCALEDIR, "${datadir}/locale", [locale directory])
AM_GLIB_GNU_GETTEXT
+##############################
+# ./configure Flags messings
+##############################
+
+cflags_set=${CFLAGS+set}
+# find the actual value for $prefix that we'll end up with
+REAL_PREFIX=
+if test "x$prefix" = "xNONE"; then
+ REAL_PREFIX=$ac_default_prefix
+else
+ REAL_PREFIX=$prefix
+fi
+
+# Have to go $sysconfdir->$prefix/etc->/usr/local/etc
+# if you actually know how to code shell then fix this :-)
+SYSCONFDIR_TMP="$sysconfdir"
+old_prefix=$prefix
+prefix=$REAL_PREFIX
+EXPANDED_SYSCONFDIR=`eval echo $SYSCONFDIR_TMP`
+prefix=$old_prefix
+AC_SUBST(EXPANDED_SYSCONFDIR)
+
+dnl Save flags to aclocal
+ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
+
+AC_DEFINE_PATH(PREFIX, "${prefix}", [prefix directory])
+AC_DEFINE_PATH(SYSCONFDIR, "${sysconfdir}", [system configuration dir])
+AC_DEFINE_PATH(LIBDIR, "${libdir}", [system configuration dir])
+
###########################
# Files
###########################
diff --git a/src/applet-main.c b/src/applet-main.c
index 62faab0..51e3c93 100644
--- a/src/applet-main.c
+++ b/src/applet-main.c
@@ -20,7 +20,9 @@ You should have received a copy of the GNU General Public License along
with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <config.h>
#include <panel-applet.h>
+#include <libgnomeui/gnome-ui-init.h>
#define SYMBOL_NAME "get_menu_item"
#define ICONS_DIR (DATADIR G_DIR_SEPARATOR_S "indicator-applet" G_DIR_SEPARATOR_S "icons")
@@ -34,6 +36,13 @@ static void cw_panel_background_changed (PanelApplet *applet,
GdkPixmap *pixmap,
GtkWidget *menubar);
+/* ****************** *
+ * Global Variables *
+ * ****************** */
+
+static GnomeProgram *program = NULL;
+
+
/*************
* main
* ***********/
@@ -172,7 +181,20 @@ applet_fill_cb (PanelApplet * applet, const gchar * iid, gpointer data)
GtkWidget *menubar;
gint i;
gint indicators_loaded = 0;
-
+ static gboolean first_time = FALSE;
+
+ if (!first_time)
+ {
+ gint argc = 1;
+ gchar *argv[2] = { "indicator-applet", NULL};
+
+ first_time = TRUE;
+ program = gnome_program_init ("indicator-applet", "0.1",
+ LIBGNOMEUI_MODULE, argc, argv,
+ GNOME_PROGRAM_STANDARD_PROPERTIES,
+ NULL);
+ }
+
/* Set panel options */
gtk_container_set_border_width(GTK_CONTAINER (applet), 0);
panel_applet_set_flags(applet, PANEL_APPLET_EXPAND_MINOR);