mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 10:04:32 +03:00
More work -mig
This commit is contained in:
parent
40f47113e0
commit
3d9ea977f0
@ -55,6 +55,13 @@ shaped_icon_new_from_file (char *file, int extra_events)
|
||||
GdkImlibImage *im;
|
||||
GdkWindowPrivate *private;
|
||||
|
||||
if (!g_file_exists (file))
|
||||
return;
|
||||
|
||||
im = gdk_imlib_load_image (file);
|
||||
if (!im)
|
||||
return NULL;
|
||||
|
||||
gtk_widget_push_visual (gdk_imlib_get_visual ());
|
||||
gtk_widget_push_colormap (gdk_imlib_get_colormap ());
|
||||
|
||||
@ -65,8 +72,6 @@ shaped_icon_new_from_file (char *file, int extra_events)
|
||||
gtk_widget_pop_colormap ();
|
||||
gtk_widget_pop_visual ();
|
||||
|
||||
im = gdk_imlib_load_image (file);
|
||||
|
||||
gtk_widget_set_usize (window, im->rgb_width, im->rgb_height);
|
||||
gtk_widget_realize (window);
|
||||
gdk_window_resize (window->window, im->rgb_width, im->rgb_height);
|
||||
@ -163,9 +168,9 @@ dentry_execute (desktop_icon_t *di)
|
||||
* invocation
|
||||
*/
|
||||
|
||||
if (strcmp (di->dentry->type, "Directory") == 0)
|
||||
do_cd (di->dentry->exec, cd_exact);
|
||||
else
|
||||
if (strcmp (di->dentry->type, "Directory") == 0){
|
||||
new_panel_at (di->dentry->exec);
|
||||
} else
|
||||
gnome_desktop_entry_launch (dentry);
|
||||
}
|
||||
|
||||
@ -204,10 +209,26 @@ desktop_load_dentry (char *filename)
|
||||
|
||||
if (dentry->icon)
|
||||
window = shaped_icon_new_from_file (dentry->icon, GDK_BUTTON_PRESS_MASK);
|
||||
else {
|
||||
static char *default_icon_path;
|
||||
static char exists;
|
||||
|
||||
if (!default_icon_path){
|
||||
default_icon_path = gnome_unconditional_pixmap_file ("launcher-program.xpm");
|
||||
if (g_file_exists (default_icon_path))
|
||||
exists = 1;
|
||||
}
|
||||
|
||||
if (exists)
|
||||
window = shaped_icon_new_from_file (default_icon_path, GDK_BUTTON_PRESS_MASK);
|
||||
else {
|
||||
window = gtk_window_new (GTK_WINDOW_POPUP);
|
||||
gtk_widget_set_usize (window, 20, 20);
|
||||
}
|
||||
}
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
di = xmalloc (sizeof (desktop_icon_t), "desktop_load_entry");
|
||||
di->dentry = dentry;
|
||||
di->widget = window;
|
||||
@ -270,6 +291,7 @@ get_desktop_icon (char *pathname)
|
||||
static void
|
||||
desktop_file_exec (GtkWidget *widget, GdkEventButton *event, desktop_icon_t *di)
|
||||
{
|
||||
if (event->type == GDK_2BUTTON_PRESS && event->button == 1)
|
||||
printf ("YOu just discovered that regex_command ('open') is not being invoked yet\n");
|
||||
}
|
||||
|
||||
@ -335,10 +357,12 @@ desktop_load (char *desktop_dir)
|
||||
desktop_create_directory_entry (dir_full, full, dent->d_name);
|
||||
|
||||
free (dir_full);
|
||||
} else if (!strstr (dent->d_name, ".desktop"))
|
||||
} else {
|
||||
if (strstr (dent->d_name, ".desktop"))
|
||||
desktop_load_dentry (full);
|
||||
else
|
||||
desktop_create_launch_entry (full, dent->d_name);
|
||||
}
|
||||
|
||||
free (full);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ typedef struct {
|
||||
Widget *other;
|
||||
} PanelContainer;
|
||||
|
||||
GList *containers;
|
||||
GList *containers = 0;
|
||||
|
||||
int output_lines = 0;
|
||||
int command_prompt = 1;
|
||||
@ -77,6 +77,20 @@ set_current_panel (int index)
|
||||
current_panel_ptr = p->data;
|
||||
}
|
||||
|
||||
void
|
||||
set_new_current_panel (WPanel *panel)
|
||||
{
|
||||
GList *p;
|
||||
|
||||
other_panel_ptr = current_panel_ptr;
|
||||
for (p = containers; p; p = p->next){
|
||||
if (((PanelContainer *)p->data)->panel == panel){
|
||||
printf ("Setting current panel to %p\n", p);
|
||||
current_panel_ptr = p->data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
print_vfs_message (char *msg)
|
||||
{
|
||||
@ -172,27 +186,19 @@ GnomeUIInfo gnome_panel_menu [] = {
|
||||
{ GNOME_APP_UI_ENDOFINFO, 0, 0 }
|
||||
};
|
||||
|
||||
int
|
||||
dialog_panel_callback (struct Dlg_head *h, int id, int msg)
|
||||
{
|
||||
return default_dlg_callback (h, id, msg);
|
||||
}
|
||||
|
||||
void
|
||||
gnome_init_panels ()
|
||||
{
|
||||
containers = g_list_alloc ();
|
||||
current_panel_ptr = NULL;
|
||||
other_panel_ptr = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
create_container (char *name)
|
||||
WPanel *
|
||||
create_container (Dlg_head *h, char *name)
|
||||
{
|
||||
PanelContainer *container = g_new (PanelContainer, 1);
|
||||
WPanel *panel;
|
||||
GtkWidget *app, *vbox;
|
||||
Dlg_head *h;
|
||||
int slot;
|
||||
|
||||
container->splitted = 0;
|
||||
@ -206,7 +212,19 @@ create_container (char *name)
|
||||
gtk_widget_show (app);
|
||||
|
||||
panel = panel_new (name);
|
||||
|
||||
/* Ultra nasty hack follows:
|
||||
* I am setting the panel->widget.wdata value here before the
|
||||
* panel X stuff gets created in the INIT message section of the
|
||||
* widget. There I put a pointer to the vbox where the panel
|
||||
* should pack itself
|
||||
*/
|
||||
panel->widget.wdata = (widget_data) vbox;
|
||||
container->panel = panel;
|
||||
if (!containers){
|
||||
containers = g_list_alloc ();
|
||||
containers->data = container;
|
||||
} else
|
||||
containers = g_list_append (containers, container);
|
||||
|
||||
if (!current_panel_ptr){
|
||||
@ -214,13 +232,25 @@ create_container (char *name)
|
||||
} else if (!other_panel_ptr)
|
||||
other_panel_ptr = container;
|
||||
|
||||
h = create_dlg (0, 0, 24, 80, 0, dialog_panel_callback, "[panel]", "midnight", DLG_NO_TED);
|
||||
add_widget (h, panel);
|
||||
bind_gtk_keys (GTK_WIDGET (app), h);
|
||||
return panel;
|
||||
}
|
||||
|
||||
gtk_object_set_data (GTK_OBJECT (h->wdata), "parent-container", vbox);
|
||||
void
|
||||
new_panel_at (char *dir)
|
||||
{
|
||||
WPanel *panel;
|
||||
Dlg_head *h = current_panel_ptr->panel->widget.parent;
|
||||
|
||||
run_dlg (h);
|
||||
mc_chdir (dir);
|
||||
panel = create_container (h, "Other");
|
||||
add_widget (h, panel);
|
||||
|
||||
/* Gross hack 2: add_widget should know that the dialog is already
|
||||
* executing and shold call the init method manually. We do so instead:
|
||||
*/
|
||||
panel->widget.callback (h, panel, WIDGET_INIT, 0);
|
||||
set_new_current_panel (panel);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -234,19 +234,28 @@ setup_sigwinch ()
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
dialog_panel_callback (struct Dlg_head *h, int id, int msg)
|
||||
{
|
||||
return default_dlg_callback (h, id, msg);
|
||||
}
|
||||
|
||||
void
|
||||
create_panels (void)
|
||||
{
|
||||
Dlg_head *h;
|
||||
WPanel *panel;
|
||||
|
||||
start_desktop ();
|
||||
cmdline = command_new (0, 0, 0);
|
||||
the_hint = label_new (0, 0, 0, NULL);
|
||||
|
||||
gnome_init_panels ();
|
||||
create_container ("My Panel");
|
||||
|
||||
h = create_dlg (0, 0, 24, 80, 0, dialog_panel_callback, "[panel]", "midnight", DLG_NO_TED);
|
||||
|
||||
panel = create_container (h, "My Panel");
|
||||
add_widget (h, panel);
|
||||
set_current_panel (0);
|
||||
run_dlg (h);
|
||||
}
|
||||
|
||||
|
||||
|
@ -675,7 +675,7 @@ void
|
||||
x_create_panel (Dlg_head *h, widget_data parent, WPanel *panel)
|
||||
{
|
||||
g_panel_contents *g = g_new (g_panel_contents, 1);
|
||||
GtkWidget *table, *status_line, *filter_w, *statusbar;
|
||||
GtkWidget *table, *status_line, *filter_w, *statusbar, *vbox;
|
||||
|
||||
g->table = gtk_table_new (2, 1, 0);
|
||||
gtk_widget_show (g->table);
|
||||
@ -711,11 +711,14 @@ x_create_panel (Dlg_head *h, widget_data parent, WPanel *panel)
|
||||
0, 0, 0);
|
||||
|
||||
gtk_widget_show (g->table);
|
||||
|
||||
/* Ultra nasty hack: pull the vbox from wdata */
|
||||
vbox = GTK_WIDGET (panel->widget.wdata);
|
||||
|
||||
panel->widget.wdata = (widget_data) g;
|
||||
|
||||
/* Now, insert our table in our parent */
|
||||
gtk_container_add (GTK_CONTAINER (gtk_object_get_data (GTK_OBJECT (h->wdata), "parent-container")),
|
||||
g->table);
|
||||
gtk_container_add (GTK_CONTAINER (vbox), g->table);
|
||||
|
||||
if (!pixmaps_ready){
|
||||
if (!GTK_WIDGET_REALIZED (g->list))
|
||||
|
@ -17,4 +17,6 @@ typedef struct {
|
||||
GtkWidget *status;
|
||||
} g_panel_contents;
|
||||
|
||||
WPanel *create_container (Dlg_head *h, char *str);
|
||||
|
||||
#endif /* __GSCREEN_H */
|
||||
|
Loading…
Reference in New Issue
Block a user