Okay,
the New-> menu item now works. Installing a .desktop item in ${prefix}/share/mc/templates will now put it in the New item menu. The exec field of it will create the new item, so choose it correctly. Next on the TODO; rehash the toolbars.
Этот коммит содержится в:
родитель
218790bdbe
Коммит
ea47bae637
@ -1,5 +1,10 @@
|
||||
1999-01-13 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* glayout.c (create_container): finished the New->menu. Looks
|
||||
better now.
|
||||
|
||||
* gcmd.c (gnome_run_new): new function.
|
||||
|
||||
* glayout.c (create_container): beginnings of the New-> menu. It
|
||||
doesn't have much yet, hopefully we'll have a good way to let apps
|
||||
register themselves with it.
|
||||
|
@ -266,6 +266,7 @@ install_mx: all
|
||||
$(mcsrcdir)/xmkdir $(DESTDIR)$(icondir)
|
||||
$(mcsrcdir)/xmkdir $(DESTDIR)$(libdir)
|
||||
$(mcsrcdir)/xmkdir $(DESTDIR)$(bindir)
|
||||
$(mcsrcdir)/xmkdir $(gnewdir)
|
||||
$(INSTALL_PROGRAM) gmc $(DESTDIR)$(bindir)/$(binprefix)gmc
|
||||
$(INSTALL_PROGRAM) corba-gmc $(DESTDIR)$(bindir)/$(binprefix)corba-gmc
|
||||
for I in $(ICONS); \
|
||||
@ -275,7 +276,7 @@ install_mx: all
|
||||
$(INSTALL_DATA) mc.keys $(DESTDIR)$(datadir)/mime-info
|
||||
$(mcsrcdir)/xmkdir $(DESTDIR)$(corbadir)
|
||||
$(INSTALL_DATA) gmc.gnorba $(DESTDIR)$(corbadir)
|
||||
|
||||
$(INSTALL_DATA) gimp.image.desktop application.x-gnumeric.desktop $(gnewdir)
|
||||
uninstall:
|
||||
-$(RMF) $(DESTDIR)$(bindir)/$(binprefix)gmc
|
||||
-$(RMF) $(DESTDIR)$(bindir)/$(binprefix)corba-gmc
|
||||
@ -285,6 +286,7 @@ uninstall:
|
||||
-$(RMF) $(DESTDIR)$(libdir)/layout
|
||||
-$(RMF) $(DESTDIR)$(datadir)/mime-info/mc.keys
|
||||
-rmdir $(DESTDIR)$(datadir)/mime-info
|
||||
-$(RMF) $(gnewdir)
|
||||
|
||||
depend dep: @gmcdep@
|
||||
|
||||
|
8
gnome/application.x-gnumeric.desktop
Обычный файл
8
gnome/application.x-gnumeric.desktop
Обычный файл
@ -0,0 +1,8 @@
|
||||
[Desktop Entry]
|
||||
Name=Gnumeric Spread Sheet
|
||||
Comment=Create a new Spread Sheet with Gnumeric
|
||||
TryExec=gnumeric
|
||||
Exec=gnumeric
|
||||
Icon=gnome-gimp.png
|
||||
Terminal=0
|
||||
Type=Application
|
@ -645,4 +645,8 @@ gnome_open_files (GtkWidget *widget, WPanel *panel)
|
||||
g_list_free (later);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
gnome_run_new (GtkWidget *widget, GnomeDesktopEntry *gde)
|
||||
{
|
||||
gnome_desktop_entry_launch (gde);
|
||||
}
|
||||
|
@ -17,5 +17,6 @@ void gnome_select_all_cmd (GtkWidget *widget, WPanel *panel);
|
||||
void gnome_filter_cmd (GtkWidget *widget, WPanel *panel);
|
||||
void gnome_external_panelize (GtkWidget *widget, WPanel *panel);
|
||||
void gnome_open_files (GtkWidget *widget, WPanel *panel);
|
||||
void gnome_run_new (GtkWidget *widget, GnomeDesktopEntry *gde);
|
||||
|
||||
#endif /* __GCMD_H */
|
||||
|
8
gnome/gimp.image.desktop
Обычный файл
8
gnome/gimp.image.desktop
Обычный файл
@ -0,0 +1,8 @@
|
||||
[Desktop Entry]
|
||||
Name=Image
|
||||
Comment=Create a new Image
|
||||
TryExec=gimp
|
||||
Exec=gimp
|
||||
Icon=gnome-gimp.png
|
||||
Terminal=0
|
||||
Type=Application
|
@ -9,6 +9,7 @@
|
||||
#include "x.h"
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include "dir.h"
|
||||
#include "panel.h"
|
||||
#include "gscreen.h"
|
||||
@ -24,6 +25,9 @@
|
||||
#include "setup.h"
|
||||
#include "../vfs/vfs.h"
|
||||
#include "gprefs.h"
|
||||
|
||||
|
||||
|
||||
#define UNDEFINED_INDEX -1
|
||||
|
||||
GList *containers = 0;
|
||||
@ -277,6 +281,7 @@ void configure_box (void);
|
||||
GtkCheckMenuItem *gnome_toggle_snap (void);
|
||||
GnomeUIInfo gnome_panel_new_menu [] = {
|
||||
{ GNOME_APP_UI_ITEM, N_("_Terminal"), N_("Launch a new terminal in the current directory"), NULL},
|
||||
/* If this ever changes, make sure you update create_new_menu accordingly. */
|
||||
{ GNOME_APP_UI_ITEM, N_("_Directory..."), N_("Creates a new directory"), mkdir_cmd },
|
||||
{ GNOME_APP_UI_ENDOFINFO, 0, 0 }
|
||||
};
|
||||
@ -455,8 +460,62 @@ create_new_menu (GnomeApp *app, WPanel *panel)
|
||||
{
|
||||
gint pos;
|
||||
GtkWidget *shell = NULL;
|
||||
gchar *file, *file2, *test;
|
||||
DIR *dir;
|
||||
struct stat filedata;
|
||||
struct dirent *dirstruc;
|
||||
GnomeDesktopEntry *gde;
|
||||
GtkWidget *menu;
|
||||
|
||||
/* what do we insert??? We check ${PREFIX}/share/gmc/templates for all .desktop files.
|
||||
* We then add them to the menu, calling their exec script to launch the new app. */
|
||||
file = gnome_datadir_file ("mc/templates");
|
||||
if (file == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
dir = opendir (file);
|
||||
if (dir == NULL) {
|
||||
g_free (file);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
shell = gnome_app_find_menu_pos (app->menubar, _("File/New/Directory..."), &pos);
|
||||
/*gtk_menu_shell_insert*/
|
||||
menu = gtk_menu_item_new ();
|
||||
gtk_widget_show (menu);
|
||||
gtk_menu_shell_insert (GTK_MENU_SHELL (shell), menu, pos++);
|
||||
|
||||
if (shell == NULL)
|
||||
return;
|
||||
while ((dirstruc = readdir (dir)) != NULL) {
|
||||
if (dirstruc->d_name[0] == '.')
|
||||
continue;
|
||||
file2 = g_concat_dir_and_file (file, dirstruc->d_name);
|
||||
if ((stat (file2, &filedata) != -1) && (S_ISREG (filedata.st_mode))) {
|
||||
gde = gnome_desktop_entry_load (file2);
|
||||
test = rindex(dirstruc->d_name, '.');
|
||||
if (test == NULL || gde == NULL || strcmp (test, ".desktop")) {
|
||||
g_free (file2);
|
||||
continue;
|
||||
}
|
||||
if (!gnome_is_program_in_path (gde->tryexec)) {
|
||||
g_free (file2);
|
||||
g_print ("yes!\n");
|
||||
continue;
|
||||
}
|
||||
menu = gtk_menu_item_new_with_label (gde->name);
|
||||
gtk_widget_show (menu);
|
||||
gtk_menu_shell_insert (GTK_MENU_SHELL (shell), menu, pos++);
|
||||
/* This is really bad, but it works. */
|
||||
if (gde->comment)
|
||||
gtk_object_set_data (GTK_OBJECT (menu), "apphelper_statusbar_hint",
|
||||
gde->comment);
|
||||
gtk_signal_connect (GTK_OBJECT (menu), "activate", GTK_SIGNAL_FUNC (gnome_run_new),
|
||||
gde);
|
||||
}
|
||||
g_free (file2);
|
||||
}
|
||||
}
|
||||
WPanel *
|
||||
create_container (Dlg_head *h, char *name, char *geometry)
|
||||
@ -487,7 +546,7 @@ create_container (Dlg_head *h, char *name, char *geometry)
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 0);
|
||||
gnome_app_set_contents (GNOME_APP (app), vbox);
|
||||
gnome_app_create_menus_with_data (GNOME_APP (app), gnome_panel_menu, panel);
|
||||
create_new_menu (app, panel);
|
||||
create_new_menu (GNOME_APP (app), panel);
|
||||
/*
|
||||
* I am trying to unclutter the screen, so this toolbar is gone now
|
||||
*/
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user