summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduard Roccatello <eduard@roccatello.it>2004-06-27 09:45:36 +0000
committerEduard Roccatello <eduard@roccatello.it>2004-06-27 09:45:36 +0000
commitecc8091b294870e00591913cf70ee34414e6c887 (patch)
tree284508f3c6c73db02b7672e5d353026674d8551a
parent75e45e8e63d9e2f1b0af614e3ba2132801cb9d63 (diff)
downloadxfce4-appfinder-ecc8091b294870e00591913cf70ee34414e6c887.tar.gz
Added infobox to the right menu
(Old svn revision: 2131)
-rw-r--r--Makefile.in2
-rw-r--r--TODO2
-rw-r--r--aclocal.m431
-rwxr-xr-xautogen.sh155
-rw-r--r--src/appfinder.h20
-rwxr-xr-xsrc/main.c145
6 files changed, 348 insertions, 7 deletions
diff --git a/Makefile.in b/Makefile.in
index a79df85..7e51763 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -178,7 +178,7 @@ $(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(srcdir)/configure.ac $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
cd $(srcdir) && $(AUTOCONF)
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.ac m4/debug.m4 m4/depends.m4 m4/i18n.m4
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.ac m4/debug.m4 m4/depends.m4 m4/i18n.m4 m4/X11.m4
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
config.h: stamp-h1
diff --git a/TODO b/TODO
index bba81b6..03b5e80 100644
--- a/TODO
+++ b/TODO
@@ -6,7 +6,7 @@ TODO
o Avoid flickering - DONE
o No item message on the apps treeview - DONE
o Recursive directory analysis
- o Menu on right click on apps treeview - 25 %
+ o Menu on right click on apps treeview - 75 %
o Custom paths
o About box
o Support for legacy apps
diff --git a/aclocal.m4 b/aclocal.m4
index 67638fd..d91a953 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -6866,6 +6866,37 @@ AC_HELP_STRING([--disable-$4], [Disable checking for $5]),
fi
])
+dnl
+dnl XFCE_PANEL_PLUGIN(var, version)
+dnl
+dnl Sets $var_CFLAGS, $var_LIBS and $var_PLUGINSDIR
+dnl
+AC_DEFUN([XFCE_PANEL_PLUGIN],
+[
+ BM_DEPEND([$1], [xfce4-panel-1.0], [$2])
+
+ dnl Check where to put the plugins to
+ AC_MSG_CHECKING([where to install panel plugins])
+ $1_PLUGINSDIR=`$PKG_CONFIG --variable=pluginsdir xfce4-panel-1.0`
+ AC_SUBST([$1_PLUGINSDIR])
+ AC_MSG_RESULT([$$1_PLUGINSDIR])
+])
+
+dnl
+dnl XFCE_MCS_PLUGIN(var, version)
+dnl
+dnl sets $var_CFLAGS, $var_LIBS and $var_PLUGINSDIR
+dnl
+AC_DEFUN([XFCE_MCS_PLUGIN],
+[
+ BM_DEPEND([$1], [xfce-mcs-manager], [$2])
+
+ dnl Check where to put the plugins to
+ AC_MSG_CHECKING([where to install MCS plugins])
+ $1_PLUGINSDIR=`$PKG_CONFIG --variable=pluginsdir xfce-mcs-manager`
+ AC_SUBST([$1_PLUGINSDIR])
+ AC_MSG_RESULT([$$1_PLUGINSDIR])
+])
dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..98ed0e9
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,155 @@
+#!/bin/sh
+# Run this to generate all the initial makefiles, etc.
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+DIE=0
+
+ACLOCAL_FLAGS="-I m4 $ACLOCAL_FLAGS"
+
+(test -f $srcdir/configure.ac) || {
+ echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
+ echo " top-level package directory"
+ exit 1
+}
+
+(autoconf --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`autoconf' installed."
+ echo "Download the appropriate package for your distribution,"
+ echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
+ DIE=1
+}
+
+(grep "^AC_PROG_INTLTOOL" $srcdir/configure.ac >/dev/null) && {
+ (intltoolize --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`intltool' installed."
+ echo "You can get it from:"
+ echo " ftp://ftp.gnome.org/pub/GNOME/"
+ DIE=1
+ }
+}
+
+(grep "^AM_PROG_XML_I18N_TOOLS" $srcdir/configure.ac >/dev/null) && {
+ (xml-i18n-toolize --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`xml-i18n-toolize' installed."
+ echo "You can get it from:"
+ echo " ftp://ftp.gnome.org/pub/GNOME/"
+ DIE=1
+ }
+}
+
+(grep "^AC_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && {
+ (libtool --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`libtool' installed."
+ echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
+ DIE=1
+ }
+}
+
+(grep "^AM_GLIB_GNU_GETTEXT" $srcdir/configure.ac >/dev/null) && {
+ (grep "sed.*POTFILES" $srcdir/configure.ac) > /dev/null || \
+ (glib-gettextize --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`glib' installed."
+ echo "You can get it from: ftp://ftp.gtk.org/pub/gtk"
+ DIE=1
+ }
+}
+
+(automake --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`automake' installed."
+ echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
+ DIE=1
+ NO_AUTOMAKE=yes
+}
+
+
+# if no automake, don't bother testing for aclocal
+test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: Missing \`aclocal'. The version of \`automake'"
+ echo "installed doesn't appear recent enough."
+ echo "You can get automake from ftp://ftp.gnu.org/pub/gnu/"
+ DIE=1
+}
+
+if test "$DIE" -eq 1; then
+ exit 1
+fi
+
+if test -z "$*"; then
+ echo "**Message**: I am going to add --enable-maintainer-mode to \`configure'."
+ echo "If you wish to pass any other to it, please specify them on the"
+ echo \`$0\'" command line."
+ echo
+
+ conf_flags="--enable-maintainer-mode"
+else
+ unset conf_flags
+fi
+
+case $CC in
+xlc )
+ am_opt=--include-deps;;
+esac
+
+for coin in `find $srcdir -path $srcdir/CVS -prune -o -name configure.ac -print`
+do
+ dr=`dirname $coin`
+ if test -f $dr/NO-AUTO-GEN; then
+ echo skipping $dr -- flagged as no auto-gen
+ else
+ echo processing $dr
+ ( cd $dr
+
+ aclocalinclude="$ACLOCAL_FLAGS"
+
+ if grep "^AM_GLIB_GNU_GETTEXT" configure.ac >/dev/null; then
+ echo "Creating $dr/aclocal.m4 ..."
+ test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
+ echo "Running glib-gettextize... Ignore non-fatal messages."
+ echo "no" | glib-gettextize --force --copy
+ echo "Making $dr/aclocal.m4 writable ..."
+ test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
+ fi
+ if grep "^AC_PROG_INTLTOOL" configure.ac >/dev/null; then
+ echo "Running intltoolize..."
+ intltoolize --copy --force --automake
+ fi
+ if grep "^AM_PROG_XML_I18N_TOOLS" configure.ac >/dev/null; then
+ echo "Running xml-i18n-toolize..."
+ xml-i18n-toolize --copy --force --automake
+ fi
+ if grep "^AC_PROG_LIBTOOL" configure.ac >/dev/null; then
+ if test -z "$NO_LIBTOOLIZE" ; then
+ echo "Running libtoolize..."
+ libtoolize --force --copy
+ fi
+ fi
+ echo "Running aclocal $aclocalinclude ..."
+ aclocal $aclocalinclude
+ if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then
+ echo "Running autoheader..."
+ autoheader
+ fi
+ echo "Running automake --foreign $am_opt ..."
+ automake --add-missing --foreign --force --copy $am_opt
+ echo "Running autoconf ..."
+ autoconf
+ )
+ fi
+done
+
+if test x$NOCONFIGURE = x; then
+ echo Running $srcdir/configure $conf_flags "$@" ...
+ $srcdir/configure $conf_flags "$@" \
+ && echo Now type \`make\' to compile. || exit 1
+else
+ echo Skipping configure process.
+fi
diff --git a/src/appfinder.h b/src/appfinder.h
index 2a8d55f..c09165a 100644
--- a/src/appfinder.h
+++ b/src/appfinder.h
@@ -31,6 +31,24 @@ typedef struct {
GtkWidget *appscroll;
} t_appfinder;
+typedef struct _afdialog AfDialog;
+struct _afdialog {
+ GtkWidget *dialog;
+ GtkWidget *frame;
+ GtkWidget *vbox;
+ GtkWidget *vboxl;
+ GtkWidget *header;
+ GtkWidget *hbox;
+ GtkWidget *img;
+ GtkWidget *name;
+ GtkWidget *comment;
+ GtkWidget *cats;
+ GtkWidget *exec;
+ GtkWidget *bbox;
+ GtkWidget *btnClose;
+ GtkWidget *separator;
+};
+
int showedcat;
const char *configfile;
@@ -61,6 +79,8 @@ cb_appstreeclick (GtkWidget *widget, GdkEventButton *event, gpointer treeview);
void cb_menurun (GtkMenuItem *menuitem, gpointer data);
+void cb_menuinfo (GtkMenuItem *menuitem, gpointer data);
+
GtkListStore *
create_categories_liststore (void);
diff --git a/src/main.c b/src/main.c
index 78056ae..1b21e7c 100755
--- a/src/main.c
+++ b/src/main.c
@@ -256,6 +256,140 @@ void cb_menurun (GtkMenuItem *menuitem, gpointer data)
}
}
+/*
+ Icon - Name
+ Comment: Comment
+ Categories: Cats
+ Command: Exec
+*/
+void cb_menuinfo (GtkMenuItem *menuitem, gpointer data)
+{
+ AfDialog *dlg;
+ GdkPixbuf *icon;
+ GdkPixbuf *icon2;
+ gchar *name = data;
+ gchar *path = NULL;
+ gchar *iconpath = NULL;
+ gchar *comment = NULL;
+ gchar *cats = NULL;
+ gchar *exec = NULL;
+ gchar **catsarray = NULL;
+ XfceDesktopEntry *dentry;
+
+ if (name && (path = get_path_from_name(name)) &&
+ XFCE_IS_DESKTOP_ENTRY(dentry = xfce_desktop_entry_new (path, keys, 7)))
+ {
+ dlg = g_new (AfDialog, 1);
+ dlg->dialog = gtk_dialog_new ();
+ gtk_window_set_title (GTK_WINDOW (dlg->dialog), _("Appfinder InfoBox"));
+ gtk_dialog_set_has_separator (GTK_DIALOG (dlg->dialog), FALSE);
+ icon = xfce_inline_icon_at_size (default_icon_data_48_48, 32, 32);
+ gtk_window_set_icon (GTK_WINDOW (dlg->dialog), icon);
+
+ dlg->vbox = GTK_DIALOG (dlg->dialog)->vbox;
+ dlg->header = xfce_create_header (icon, g_strconcat(_("Informations about \""), name, "\"", NULL));
+ gtk_widget_show (dlg->header);
+ gtk_box_pack_start (GTK_BOX (dlg->vbox), dlg->header, FALSE, TRUE, 0);
+ g_object_unref(icon);
+
+ dlg->hbox = gtk_hbox_new(FALSE, 0);
+ gtk_widget_show(dlg->hbox);
+ gtk_box_pack_start (GTK_BOX (dlg->vbox), dlg->hbox, TRUE, TRUE, 10);
+
+ dlg->vboxl = gtk_vbox_new(FALSE, 0);
+ gtk_widget_show(dlg->vboxl);
+ gtk_box_pack_start (GTK_BOX (dlg->hbox), dlg->vboxl, TRUE, TRUE, 10);
+
+ dlg->frame = gtk_aspect_frame_new ("Icon", 0.5, 0.5, 1.8, TRUE);
+ gtk_widget_show(dlg->frame);
+ gtk_box_pack_start (GTK_BOX (dlg->hbox), dlg->frame, FALSE, TRUE, 10);
+
+ xfce_desktop_entry_get_string (dentry, "Icon", FALSE, &iconpath);
+ if (iconpath)
+ {
+ icon = load_icon_entry (iconpath);
+ if (icon)
+ icon = gdk_pixbuf_scale_simple(icon, 48, 48, GDK_INTERP_BILINEAR);
+ else
+ {
+ icon = xfce_inline_icon_at_size (default_icon_data_48_48, 48, 48);
+ icon2 = gdk_pixbuf_copy (icon);
+ gdk_pixbuf_saturate_and_pixelate(icon, icon2, 0.0, TRUE);
+ g_object_unref(icon);
+ icon = icon2;
+ }
+ g_free(iconpath);
+ }
+ else
+ icon = xfce_inline_icon_at_size (default_icon_data_48_48, 48, 48);
+
+ dlg->img = gtk_image_new_from_pixbuf (icon);
+ gtk_widget_show(dlg->img);
+ gtk_container_add (GTK_CONTAINER (dlg->frame), dlg->img);
+
+ dlg->name = gtk_label_new(NULL);
+ gtk_label_set_markup (GTK_LABEL(dlg->name), g_strconcat("<b>Name:</b> ", name, NULL));
+ gtk_misc_set_alignment (GTK_MISC(dlg->name), 0, 0);
+ gtk_widget_show(dlg->name);
+ gtk_box_pack_start (GTK_BOX (dlg->vboxl), dlg->name, FALSE, FALSE, 0);
+
+ xfce_desktop_entry_get_string (dentry, "Comment", FALSE, &comment);
+ if (!comment)
+ comment = "N/A";
+ dlg->comment = gtk_label_new(NULL);
+ gtk_label_set_line_wrap (GTK_LABEL(dlg->comment), TRUE);
+ gtk_label_set_markup (GTK_LABEL(dlg->comment), g_strconcat("<b>Comment:</b> ", comment, NULL));
+ g_free(comment);
+ gtk_misc_set_alignment (GTK_MISC(dlg->comment), 0, 0);
+ gtk_widget_show(dlg->comment);
+ gtk_box_pack_start (GTK_BOX (dlg->vboxl), dlg->comment, FALSE, FALSE, 0);
+
+ xfce_desktop_entry_get_string (dentry, "Categories", FALSE, &cats);
+ if (!cats)
+ cats = "N/A";
+ else
+ {
+ catsarray = g_strsplit (cats, ";", 0);
+ cats = g_strchomp (g_strjoinv (", ", catsarray));
+ cats[strlen(cats)-1] = '\0';
+ g_strfreev (catsarray);
+ }
+
+ dlg->cats = gtk_label_new(NULL);
+ gtk_label_set_markup (GTK_LABEL(dlg->cats), g_strconcat("<b>Categories:</b> ", cats, NULL));
+ g_free(cats);
+ gtk_misc_set_alignment (GTK_MISC(dlg->cats), 0, 0);
+ gtk_widget_show(dlg->cats);
+ gtk_box_pack_start (GTK_BOX (dlg->vboxl), dlg->cats, FALSE, FALSE, 0);
+
+ xfce_desktop_entry_get_string (dentry, "Exec", FALSE, &exec);
+ if (!exec)
+ exec = "N/A";
+ dlg->exec = gtk_label_new(NULL);
+ gtk_label_set_markup (GTK_LABEL(dlg->exec), g_strconcat("<b>Command:</b> ", exec, NULL));
+ gtk_misc_set_alignment (GTK_MISC(dlg->exec), 0, 0);
+ g_free(exec);
+ gtk_widget_show(dlg->exec);
+ gtk_box_pack_start (GTK_BOX (dlg->vboxl), dlg->exec, FALSE, FALSE, 0);
+
+ dlg->separator = gtk_hseparator_new();
+ gtk_widget_show(dlg->separator);
+ gtk_box_pack_start (GTK_BOX (dlg->vbox), dlg->separator, FALSE, TRUE, 0);
+
+ dlg->btnClose = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
+ gtk_dialog_add_action_widget (GTK_DIALOG (dlg->dialog), dlg->btnClose, GTK_RESPONSE_CLOSE);
+ GTK_WIDGET_SET_FLAGS (dlg->btnClose, GTK_CAN_DEFAULT);
+ gtk_widget_show(dlg->btnClose);
+
+ g_signal_connect_swapped (GTK_OBJECT (dlg->dialog), "response",
+ G_CALLBACK (gtk_widget_destroy), GTK_OBJECT (dlg->dialog));
+
+ gtk_widget_grab_focus (dlg->btnClose);
+ gtk_widget_show(dlg->dialog);
+ g_free(name);
+ }
+}
+
gboolean
cb_appstreeclick (GtkWidget *widget, GdkEventButton *event, gpointer treeview)
{
@@ -299,9 +433,9 @@ cb_appstreeclick (GtkWidget *widget, GdkEventButton *event, gpointer treeview)
menuitem = gtk_image_menu_item_new_with_label ("Informations...");
icon = gtk_image_new_from_stock (GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM(menuitem), icon);
+ g_signal_connect (G_OBJECT(menuitem), "activate", G_CALLBACK(cb_menuinfo), (gpointer)name);
gtk_widget_show (icon);
gtk_widget_show (menuitem);
- gtk_widget_set_sensitive (menuitem, FALSE);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
menuitem = gtk_separator_menu_item_new ();
@@ -507,11 +641,8 @@ load_icon_entry (gchar *img)
error = NULL;
icon = NULL;
}
- /* We have the icon loaded so we can scale it to 24x24 */
- else
- icon = gdk_pixbuf_scale_simple(icon, 24, 24, GDK_INTERP_BILINEAR);
- return icon;
+ return icon;
}
/*
@@ -551,6 +682,8 @@ GtkListStore *fetch_desktop_resources (gint category, gchar *pattern) {
if (xfce_desktop_entry_get_string (dentry, "Icon", FALSE, &img) && img)
{
icon = load_icon_entry(img);
+ if (icon)
+ icon = gdk_pixbuf_scale_simple(icon, 24, 24, GDK_INTERP_BILINEAR);
g_free(img);
}
else
@@ -691,6 +824,8 @@ GtkListStore *fetch_desktop_resources (gint category, gchar *pattern) {
if (xfce_desktop_entry_get_string (dentry, "Icon", FALSE, &img) && img)
{
icon = load_icon_entry(img);
+ if (icon)
+ icon = gdk_pixbuf_scale_simple(icon, 24, 24, GDK_INTERP_BILINEAR);
g_free(img);
}
else